Base code merged to SPIN 2.4
[platform/upstream/curl.git] / tests / libtest / CMakeLists.txt
index 08edbd0..cc9d7e1 100644 (file)
@@ -5,32 +5,26 @@ function(SETUP_TEST TEST_NAME)          # ARGN are the files in the test
   string(TOUPPER ${TEST_NAME} UPPER_TEST_NAME)
 
   include_directories(
-    ${CURL_SOURCE_DIR}/lib          # To be able to reach "setup_once.h"
-    ${CURL_BINARY_DIR}/lib          # To be able to reach "config.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(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 PROJECT_LABEL "${TARGET_LABEL_PREFIX}${TEST_NAME}")
 
-  # Add the postfix to the executable since it is 
+  # Add the postfix to the executable since it is
   # not added automatically as for modules and shared libraries
-  set_target_properties(${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()
 
 
@@ -41,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)
@@ -63,8 +66,7 @@ endforeach()
 # lib547
 # #lib548
 # lib549 lib552 lib553 lib554 lib555 lib556
-# lib539 lib557 lib558
-# #lib559
+# lib539 lib557
 # lib560
 # )
 
@@ -118,8 +120,3 @@ endforeach()
 # SET(SOURCE "lib547.c" ${SUPPORTFILES})
 # ADD_TESTUTIL_IF_NECESSARY(${TEST_NAME})
 # SETUP_TEST(${TEST_NAME} ${SOURCE})
-
-# SET(TEST_NAME lib559)
-# SET(SOURCE "lib558.c" ${SUPPORTFILES})
-# ADD_TESTUTIL_IF_NECESSARY(${TEST_NAME})
-# SETUP_TEST(${TEST_NAME} ${SOURCE})