CMakeLists.txt 2.6 KB

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