File tree Expand file tree Collapse file tree 2 files changed +11
-10
lines changed
Expand file tree Collapse file tree 2 files changed +11
-10
lines changed Original file line number Diff line number Diff line change @@ -14,8 +14,6 @@ INCLUDE (CheckLibraryExists)
1414
1515PROJECT (c-ares LANGUAGES C VERSION "1.22.1" )
1616
17- INCLUDE (EnableWarnings)
18-
1917# Set this version before release
2018SET (CARES_VERSION "${PROJECT_VERSION} " )
2119
@@ -46,13 +44,23 @@ OPTION (CARES_SYMBOL_HIDING "Hide private symbols in shared libraries"
4644SET (CARES_RANDOM_FILE "/dev/urandom" CACHE STRING "Suitable File / Device Path for entropy, such as /dev/urandom" )
4745
4846
47+ # Tests require a C++ compiler
48+ IF (CARES_BUILD_TESTS OR CARES_BUILD_CONTAINER_TESTS)
49+ set (CMAKE_CXX_STANDARD 11)
50+ set (CMAKE_CXX_STANDARD_REQUIRED TRUE )
51+ set (CMAKE_CXX_EXTENSIONS FALSE )
52+ enable_language (CXX)
53+ ENDIF ()
54+
4955# Tests require static to be enabled on Windows to be able to access otherwise hidden symbols
50- IF (CARES_BUILD_TESTS AND (NOT CARES_STATIC) AND WIN32 )
56+ IF (( CARES_BUILD_TESTS OR CARES_BUILD_CONTAINER_TESTS) AND (NOT CARES_STATIC) AND WIN32 )
5157 SET (CARES_STATIC ON )
5258 SET (CARES_STATIC_PIC ON )
5359 MESSAGE (WARNING "Static building was requested be disabled, but reenabled to support tests" )
5460ENDIF ()
5561
62+ INCLUDE (EnableWarnings)
63+
5664# allow linking against the static runtime library in msvc
5765IF (MSVC )
5866 OPTION (CARES_MSVC_STATIC_RUNTIME "Link against the static runtime library" OFF )
Original file line number Diff line number Diff line change 11# Copyright (C) The c-ares project and its contributors
22# SPDX-License-Identifier: MIT
3- set (CMAKE_CXX_STANDARD 11)
4- set (CMAKE_CXX_STANDARD_REQUIRED TRUE )
5- set (CMAKE_CXX_EXTENSIONS FALSE )
6-
7- enable_language (CXX)
83
94# Get rid of: warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
105IF (MSVC )
@@ -25,8 +20,6 @@ target_include_directories(caresinternal
2520 "${CMAKE_INSTALL_INCLUDEDIR} "
2621)
2722
28-
29-
3023IF (CARES_STATIC)
3124 target_link_libraries (caresinternal INTERFACE ${PROJECT_NAME} ::cares_static)
3225ELSE ()
You can’t perform that action at this time.
0 commit comments