aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2014-11-06 01:32:44 +0100
committerDaniel Stenberg <daniel@haxx.se>2014-11-10 09:08:46 +0100
commit767aaf587ce93720951d3c081acb4d61d5280755 (patch)
tree81b6ec7a9c22218cc37c1abb90c997b560c7fb4a
parent10286f45e7c0813f6122cd8fd957e96a9f921b16 (diff)
cmake: build libhostname for test suite
Used by some test cases via LD_PRELOAD in order to fake the host name. Signed-off-by: Peter Wu <peter@lekensteyn.nl>
-rw-r--r--tests/libtest/CMakeLists.txt9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/libtest/CMakeLists.txt b/tests/libtest/CMakeLists.txt
index 73aaaa117..ef73e553e 100644
--- a/tests/libtest/CMakeLists.txt
+++ b/tests/libtest/CMakeLists.txt
@@ -35,6 +35,15 @@ foreach(TEST_NAME ${noinst_PROGRAMS})
setup_test(${TEST_NAME} ${${TEST_NAME}_SOURCES})
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)
+ # Output to .libs for compatibility with autotools, the test data expects a
+ # library at (tests)/libtest/.libs/libhostname.so
+ set_target_properties(hostname PROPERTIES
+ LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/.libs)
+endif()
# # files used only in some libcurl test programs
# SET(TESTUTIL testutil.c testutil.h)