2
0

CMakeLists.txt 2.1 KB

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