Home | History | Annotate | Download | only in server
      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(USE_ARES)
     13     include_directories(${CARES_INCLUDE_DIR})
     14   endif()
     15 
     16   target_link_libraries(${TEST_NAME} ${CURL_LIBS})
     17 
     18   # Test servers simply are standalone programs that do not use libcurl
     19   # library.  For convinience and to ease portability of these servers,
     20   # some source code files from the libcurl subdirectory are also used
     21   # to build the servers.  In order to achieve proper linkage of these
     22   # files on Win32 targets it is necessary to build the test servers
     23   # with CURL_STATICLIB defined, independently of how libcurl is built.
     24   if(NOT CURL_STATICLIB)
     25     set_target_properties(${TEST_NAME} PROPERTIES
     26       COMPILE_DEFINITIONS CURL_STATICLIB)       # ${UPPER_TEST_NAME}
     27   endif()
     28   set_target_properties(${TEST_NAME} PROPERTIES
     29     PROJECT_LABEL "${TARGET_LABEL_PREFIX}${TEST_NAME}")
     30 
     31   # Add the postfix to the executable since it is not added
     32   # automatically as for modules and shared libraries
     33   set_target_properties(${TEST_NAME} PROPERTIES
     34     DEBUG_POSTFIX "${CMAKE_DEBUG_POSTFIX}")
     35 
     36 endfunction()
     37 
     38 
     39 transform_makefile_inc("Makefile.inc"
     40   "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
     41 include(${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake)
     42 
     43 foreach(EXECUTABLE_NAME ${noinst_PROGRAMS})
     44   setup_executable(${EXECUTABLE_NAME} ${${EXECUTABLE_NAME}_SOURCES})
     45 endforeach()
     46 
     47 
     48 # SET(useful
     49 # getpart.c getpart.h
     50 # ${CURL_SOURCE_DIR}/lib/strequal.c
     51 # ${CURL_SOURCE_DIR}/lib/base64.c
     52 # ${CURL_SOURCE_DIR}/lib/mprintf.c
     53 # ${CURL_SOURCE_DIR}/lib/memdebug.c
     54 # ${CURL_SOURCE_DIR}/lib/timeval.c
     55 # )
     56 
     57 # SETUP_EXECUTABLE(sws sws.c util.c util.h ${useful})
     58 # SETUP_EXECUTABLE(resolve resolve.c util.c util.h ${useful})
     59 # SETUP_EXECUTABLE(sockfilt sockfilt.c util.c util.h ${useful} ${CURL_SOURCE_DIR}/lib/inet_pton.c)
     60 # SETUP_EXECUTABLE(getpart testpart.c ${useful})
     61 # SETUP_EXECUTABLE(tftpd tftpd.c util.c util.h ${useful} tftp.h)
     62 
     63