string(TOUPPER ${TEST_NAME} UPPER_TEST_NAME)
include_directories(
- ${CURL_SOURCE_DIR}/lib # To be able to reach "setup_once.h"
+ ${CURL_SOURCE_DIR}/lib # To be able to reach "curl_setup_once.h"
${CURL_BINARY_DIR}/lib # To be able to reach "curl_config.h"
${CURL_BINARY_DIR}/include # To be able to reach "curl/curlbuild.h"
)
- if(CURL_USE_ARES)
+ if(USE_ARES)
include_directories(${CARES_INCLUDE_DIR})
endif()
- setup_curl_dependencies(${TEST_NAME})
- target_link_libraries( ${TEST_NAME} libcurl )
+
+ target_link_libraries( ${TEST_NAME} libcurl ${CURL_LIBS})
set_target_properties(${TEST_NAME}
PROPERTIES COMPILE_DEFINITIONS ${UPPER_TEST_NAME})
set_target_properties(${TEST_NAME}
PROPERTIES DEBUG_POSTFIX "${CMAKE_DEBUG_POSTFIX}")
- if(MSVC)
- if(NOT BUILD_RELEASE_DEBUG_DIRS)
- # Ugly workaround to remove the "/debug" or "/release" in each output
- set_target_properties(${TEST_NAME} PROPERTIES PREFIX "../")
- set_target_properties(${TEST_NAME} PROPERTIES IMPORT_PREFIX "../")
- endif()
- endif()
-
endfunction()
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)