aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2020-05-10 02:10:20 +0200
committerDaniel Stenberg <daniel@haxx.se>2020-05-12 08:50:07 +0200
commitc2ab2494ef375bfc5d621b39badabeb9a0c86f6a (patch)
treedf1bbfc79ab9a368b4f1ec428c07acee4b7f874f /tests
parent90bbfb5136425ab59516c8dcaabefb54b6c56d2b (diff)
CMake: do not build test programs by default
The default target should only build libcurl and curl. Add a dedicated 'testdeps' target which will be used later when running tests. Note that unittests are currently broken in CMake and already excluded. Closes #5368
Diffstat (limited to 'tests')
-rw-r--r--tests/CMakeLists.txt1
-rw-r--r--tests/libtest/CMakeLists.txt6
-rw-r--r--tests/server/CMakeLists.txt3
-rw-r--r--tests/unit/CMakeLists.txt3
4 files changed, 9 insertions, 4 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index a145b2b04..caba3c86a 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -19,6 +19,7 @@
# KIND, either express or implied.
#
###########################################################################
+add_custom_target(testdeps)
add_subdirectory(data)
add_subdirectory(libtest)
add_subdirectory(server)
diff --git a/tests/libtest/CMakeLists.txt b/tests/libtest/CMakeLists.txt
index 1fdfc0da2..cc38a97c6 100644
--- a/tests/libtest/CMakeLists.txt
+++ b/tests/libtest/CMakeLists.txt
@@ -22,7 +22,8 @@
set(TARGET_LABEL_PREFIX "Test ")
function(setup_test TEST_NAME) # ARGN are the files in the test
- add_executable( ${TEST_NAME} ${ARGN} )
+ add_executable(${TEST_NAME} EXCLUDE_FROM_ALL ${ARGN})
+ add_dependencies(testdeps ${TEST_NAME})
string(TOUPPER ${TEST_NAME} UPPER_TEST_NAME)
include_directories(
@@ -58,7 +59,8 @@ endforeach()
# Allows for hostname override to make tests machine independent.
# TODO this cmake build assumes a shared build, detect static linking here!
if(NOT WIN32)
- add_library(hostname MODULE sethostname.c sethostname.h)
+ add_library(hostname MODULE EXCLUDE_FROM_ALL sethostname.c sethostname.h)
+ add_dependencies(testdeps hostname)
# Output to .libs for compatibility with autotools, the test data expects a
# library at (tests)/libtest/.libs/libhostname.so
set_target_properties(hostname PROPERTIES
diff --git a/tests/server/CMakeLists.txt b/tests/server/CMakeLists.txt
index 7c64f0a8d..3bfa64921 100644
--- a/tests/server/CMakeLists.txt
+++ b/tests/server/CMakeLists.txt
@@ -26,7 +26,8 @@ if(MSVC)
endif()
function(SETUP_EXECUTABLE TEST_NAME) # ARGN are the files in the test
- add_executable(${TEST_NAME} ${ARGN})
+ add_executable(${TEST_NAME} EXCLUDE_FROM_ALL ${ARGN})
+ add_dependencies(testdeps ${TEST_NAME})
string(TOUPPER ${TEST_NAME} UPPER_TEST_NAME)
include_directories(
diff --git a/tests/unit/CMakeLists.txt b/tests/unit/CMakeLists.txt
index a8c462b82..a18ea18e0 100644
--- a/tests/unit/CMakeLists.txt
+++ b/tests/unit/CMakeLists.txt
@@ -58,7 +58,8 @@ include_directories(
foreach(_testfile ${UT_SRC})
get_filename_component(_testname ${_testfile} NAME_WE)
- add_executable(${_testname} ${_testfile} ${UT_COMMON_FILES})
+ add_executable(${_testname} EXCLUDE_FROM_ALL ${_testfile} ${UT_COMMON_FILES})
+ #add_dependencies(testdeps ${_testname})
target_link_libraries(${_testname} libcurl ${CURL_LIBS})
set_target_properties(${_testname}
PROPERTIES COMPILE_DEFINITIONS "UNITTESTS")