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