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