CMakeLists.txt 2.3 KB

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