• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1set(TARGET_LABEL_PREFIX "Test server ")
2
3if(MSVC)
4  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4127 /wd4306")
5endif()
6
7function(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 convenience 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(BUILD_SHARED_LIBS)
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}")
34endfunction()
35
36
37transform_makefile_inc("Makefile.inc"
38  "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
39include(${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake)
40
41foreach(EXECUTABLE_NAME ${noinst_PROGRAMS})
42  setup_executable(${EXECUTABLE_NAME} ${${EXECUTABLE_NAME}_SOURCES})
43endforeach()
44
45
46# SET(useful
47# getpart.c getpart.h
48# ${CURL_SOURCE_DIR}/lib/strequal.c
49# ${CURL_SOURCE_DIR}/lib/base64.c
50# ${CURL_SOURCE_DIR}/lib/mprintf.c
51# ${CURL_SOURCE_DIR}/lib/memdebug.c
52# ${CURL_SOURCE_DIR}/lib/timeval.c
53# )
54
55# SETUP_EXECUTABLE(sws sws.c util.c util.h ${useful})
56# SETUP_EXECUTABLE(resolve resolve.c util.c util.h ${useful})
57# SETUP_EXECUTABLE(sockfilt sockfilt.c util.c util.h ${useful} ${CURL_SOURCE_DIR}/lib/inet_pton.c)
58# SETUP_EXECUTABLE(getpart testpart.c ${useful})
59# SETUP_EXECUTABLE(tftpd tftpd.c util.c util.h ${useful} tftp.h)
60