mirror of https://github.com/getdnsapi/getdns.git
Rearrange includes, to CTest and thus BUILD_TESTING is always present.
We can then use BUILD_TESTING to control whether to build the test executables or not.
This commit is contained in:
parent
e4c2ddb401
commit
e8eafdfa44
|
@ -40,10 +40,13 @@ set(GETDNS_VERSION_AGE 1)
|
||||||
|
|
||||||
include(CheckCSourceRuns)
|
include(CheckCSourceRuns)
|
||||||
include(CheckFunctionExists)
|
include(CheckFunctionExists)
|
||||||
include(CheckLibraryExists)
|
|
||||||
include(CheckIncludeFile)
|
include(CheckIncludeFile)
|
||||||
|
include(CheckLibraryExists)
|
||||||
include(CheckSymbolExists)
|
include(CheckSymbolExists)
|
||||||
include(CheckTypeSize)
|
include(CheckTypeSize)
|
||||||
|
include(CMakeDependentOption)
|
||||||
|
include(CTest)
|
||||||
|
include(GNUInstallDirs)
|
||||||
include(TestBigEndian)
|
include(TestBigEndian)
|
||||||
|
|
||||||
project(getdns VERSION ${PACKAGE_VERSION} LANGUAGES C)
|
project(getdns VERSION ${PACKAGE_VERSION} LANGUAGES C)
|
||||||
|
@ -51,8 +54,6 @@ project(getdns VERSION ${PACKAGE_VERSION} LANGUAGES C)
|
||||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||||
|
|
||||||
# Directories
|
# Directories
|
||||||
include(GNUInstallDirs)
|
|
||||||
|
|
||||||
if (DEFINED CMAKE_INSTALL_FULL_RUNSTATEDIR)
|
if (DEFINED CMAKE_INSTALL_FULL_RUNSTATEDIR)
|
||||||
set(RUNSTATEDIR "${CMAKE_INSTALL_FULL_RUNSTATEDIR}")
|
set(RUNSTATEDIR "${CMAKE_INSTALL_FULL_RUNSTATEDIR}")
|
||||||
else ()
|
else ()
|
||||||
|
@ -104,7 +105,6 @@ if ((NOT ENABLE_SHARED) AND (NOT ENABLE_STATIC))
|
||||||
message(FATAL_ERROR "You must build either static or shared libraries.")
|
message(FATAL_ERROR "You must build either static or shared libraries.")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
include(CMakeDependentOption)
|
|
||||||
option(ENABLE_DEBUG_ALL "Enable all debugging messages.")
|
option(ENABLE_DEBUG_ALL "Enable all debugging messages.")
|
||||||
cmake_dependent_option(ENABLE_DEBUG_REQ "Enable request debugging messages." OFF "NOT ENABLE_DEBUG_ALL" ON)
|
cmake_dependent_option(ENABLE_DEBUG_REQ "Enable request debugging messages." OFF "NOT ENABLE_DEBUG_ALL" ON)
|
||||||
cmake_dependent_option(ENABLE_DEBUG_SCHED "Enable scheduling debugging messages." OFF "NOT ENABLE_DEBUG_ALL" ON)
|
cmake_dependent_option(ENABLE_DEBUG_SCHED "Enable scheduling debugging messages." OFF "NOT ENABLE_DEBUG_ALL" ON)
|
||||||
|
@ -618,11 +618,12 @@ target_link_libraries(getdns_server_mon
|
||||||
)
|
)
|
||||||
set_property(TARGET getdns_server_mon PROPERTY C_STANDARD 11)
|
set_property(TARGET getdns_server_mon PROPERTY C_STANDARD 11)
|
||||||
|
|
||||||
find_package(Check "0.9.6")
|
if (BUILD_TESTING)
|
||||||
|
find_package(Check "0.9.6")
|
||||||
|
|
||||||
if (NOT Check_FOUND)
|
if (NOT Check_FOUND)
|
||||||
message(WARNING "check library not found, not building test programs")
|
message(WARNING "check library not found, not building test programs")
|
||||||
else ()
|
else ()
|
||||||
add_executable(check_getdns
|
add_executable(check_getdns
|
||||||
src/test/check_getdns_common.c
|
src/test/check_getdns_common.c
|
||||||
src/test/check_getdns_context_set_timeout.c
|
src/test/check_getdns_context_set_timeout.c
|
||||||
|
@ -661,12 +662,11 @@ else ()
|
||||||
add_executable(tests_stub_sync src/test/tests_stub_sync.c)
|
add_executable(tests_stub_sync src/test/tests_stub_sync.c)
|
||||||
target_link_libraries(tests_stub_sync PRIVATE getdns Check::Check)
|
target_link_libraries(tests_stub_sync PRIVATE getdns Check::Check)
|
||||||
|
|
||||||
include(CTest)
|
|
||||||
|
|
||||||
add_test(NAME test_noeventloop COMMAND check_getdns)
|
add_test(NAME test_noeventloop COMMAND check_getdns)
|
||||||
set_property(TEST test_noeventloop PROPERTY
|
set_property(TEST test_noeventloop PROPERTY
|
||||||
ENVIRONMENT "GETDNS_TEST_PORT=43210;CK_TIMEOUT_MULTIPLIER=2;CK_LOG_FILE_NAME=check_getdns.log"
|
ENVIRONMENT "GETDNS_TEST_PORT=43210;CK_TIMEOUT_MULTIPLIER=2;CK_LOG_FILE_NAME=check_getdns.log"
|
||||||
)
|
)
|
||||||
|
endif ()
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
# Substitutions in files.
|
# Substitutions in files.
|
||||||
|
|
Loading…
Reference in New Issue