69cc56cfc8c1f94251cf1341081e72e91d16ee44
[platform/upstream/curl.git] / tests / server / CMakeLists.txt
1 set(TARGET_LABEL_PREFIX "Test server ")
2
3 function(SETUP_EXECUTABLE TEST_NAME)    # ARGN are the files in the test
4   add_executable( ${TEST_NAME} ${ARGN} )
5   string(TOUPPER ${TEST_NAME} UPPER_TEST_NAME)
6
7   include_directories(
8     ${CURL_SOURCE_DIR}/lib      # To be able to reach "curl_setup_once.h"
9     ${CURL_BINARY_DIR}/lib      # To be able to reach "curl_config.h"
10     ${CURL_BINARY_DIR}/include  # To be able to reach "curl/curlbuild.h"
11     )
12   if(CURL_USE_ARES)
13     include_directories(${CARES_INCLUDE_DIR})
14   endif()
15   # resolve test needs this
16   setup_curl_dependencies(${TEST_NAME})
17   #TARGET_LINK_LIBRARIES( ${TEST_NAME} libcurl )
18
19   # Test servers simply are standalone programs that do not use libcurl
20   # library.  For convinience and to ease portability of these servers,
21   # some source code files from the libcurl subdirectory are also used
22   # to build the servers.  In order to achieve proper linkage of these
23   # files on Win32 targets it is necessary to build the test servers
24   # with CURL_STATICLIB defined, independently of how libcurl is built.
25   if(NOT CURL_STATICLIB)
26     set_target_properties(${TEST_NAME} PROPERTIES
27       COMPILE_DEFINITIONS CURL_STATICLIB)       # ${UPPER_TEST_NAME}
28   endif()
29   set_target_properties(${TEST_NAME} PROPERTIES
30     PROJECT_LABEL "${TARGET_LABEL_PREFIX}${TEST_NAME}")
31
32   # Add the postfix to the executable since it is not added
33   # automatically as for modules and shared libraries
34   set_target_properties(${TEST_NAME} PROPERTIES
35     DEBUG_POSTFIX "${CMAKE_DEBUG_POSTFIX}")
36
37   if(MSVC)
38     if(NOT BUILD_RELEASE_DEBUG_DIRS)
39       # Ugly workaround to remove the "/debug" or "/release" in each output
40       set_target_properties(${TEST_NAME} PROPERTIES PREFIX "../")
41       set_target_properties(${TEST_NAME} PROPERTIES IMPORT_PREFIX "../")
42     endif()
43   endif()
44
45 endfunction()
46
47
48 transform_makefile_inc("Makefile.inc"
49   "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
50 include(${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake)
51
52 foreach(EXECUTABLE_NAME ${noinst_PROGRAMS})
53   setup_executable(${EXECUTABLE_NAME} ${${EXECUTABLE_NAME}_SOURCES})
54 endforeach()
55
56
57 # SET(useful
58 # getpart.c getpart.h
59 # ${CURL_SOURCE_DIR}/lib/strequal.c
60 # ${CURL_SOURCE_DIR}/lib/base64.c
61 # ${CURL_SOURCE_DIR}/lib/mprintf.c
62 # ${CURL_SOURCE_DIR}/lib/memdebug.c
63 # ${CURL_SOURCE_DIR}/lib/timeval.c
64 # )
65
66 # SETUP_EXECUTABLE(sws sws.c util.c util.h ${useful})
67 # SETUP_EXECUTABLE(resolve resolve.c util.c util.h ${useful})
68 # SETUP_EXECUTABLE(sockfilt sockfilt.c util.c util.h ${useful} ${CURL_SOURCE_DIR}/lib/inet_pton.c)
69 # SETUP_EXECUTABLE(getpart testpart.c ${useful})
70 # SETUP_EXECUTABLE(tftpd tftpd.c util.c util.h ${useful} tftp.h)
71