CMakeLists.txt 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #***************************************************************************
  2. # _ _ ____ _
  3. # Project ___| | | | _ \| |
  4. # / __| | | | |_) | |
  5. # | (__| |_| | _ <| |___
  6. # \___|\___/|_| \_\_____|
  7. #
  8. # Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
  9. #
  10. # This software is licensed as described in the file COPYING, which
  11. # you should have received as part of this distribution. The terms
  12. # are also available at https://curl.se/docs/copyright.html.
  13. #
  14. # You may opt to use, copy, modify, merge, publish, distribute and/or sell
  15. # copies of the Software, and permit persons to whom the Software is
  16. # furnished to do so, under the terms of the COPYING file.
  17. #
  18. # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  19. # KIND, either express or implied.
  20. #
  21. # SPDX-License-Identifier: curl
  22. #
  23. ###########################################################################
  24. set(TARGET_LABEL_PREFIX "Test server ")
  25. if(MSVC)
  26. set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4306")
  27. endif()
  28. function(SETUP_EXECUTABLE TEST_NAME) # ARGN are the files in the test
  29. add_executable(${TEST_NAME} EXCLUDE_FROM_ALL ${ARGN})
  30. add_dependencies(testdeps ${TEST_NAME})
  31. string(TOUPPER ${TEST_NAME} UPPER_TEST_NAME)
  32. include_directories(
  33. ${CURL_SOURCE_DIR}/lib # for "curl_setup_once.h"
  34. ${CURL_BINARY_DIR}/lib # for "curl_config.h"
  35. ${CURL_BINARY_DIR}/include # for "curl/curl.h"
  36. ${CURL_SOURCE_DIR}/src # for "tool_xattr.h"
  37. )
  38. if(USE_ARES)
  39. include_directories(${CARES_INCLUDE_DIR})
  40. endif()
  41. target_link_libraries(${TEST_NAME} ${CURL_LIBS})
  42. # Test servers simply are standalone programs that do not use libcurl
  43. # library. For convenience and to ease portability of these servers,
  44. # some source code files from the libcurl subdirectory are also used
  45. # to build the servers. In order to achieve proper linkage of these
  46. # files on Win32 targets it is necessary to build the test servers
  47. # with CURL_STATICLIB defined, independently of how libcurl is built.
  48. set_target_properties(${TEST_NAME} PROPERTIES
  49. COMPILE_DEFINITIONS CURL_STATICLIB) # ${UPPER_TEST_NAME}
  50. set_target_properties(${TEST_NAME} PROPERTIES
  51. PROJECT_LABEL "${TARGET_LABEL_PREFIX}${TEST_NAME}")
  52. endfunction()
  53. transform_makefile_inc("Makefile.inc"
  54. "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
  55. include(${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake)
  56. foreach(EXECUTABLE_NAME ${noinst_PROGRAMS})
  57. setup_executable(${EXECUTABLE_NAME} ${${EXECUTABLE_NAME}_SOURCES})
  58. endforeach()
  59. # set(useful
  60. # getpart.c getpart.h
  61. # ${CURL_SOURCE_DIR}/lib/strequal.c
  62. # ${CURL_SOURCE_DIR}/lib/base64.c
  63. # ${CURL_SOURCE_DIR}/lib/mprintf.c
  64. # ${CURL_SOURCE_DIR}/lib/memdebug.c
  65. # ${CURL_SOURCE_DIR}/lib/timeval.c
  66. # )
  67. # setup_executable(sws sws.c util.c util.h ${useful})
  68. # setup_executable(resolve resolve.c util.c util.h ${useful})
  69. # setup_executable(sockfilt sockfilt.c util.c util.h ${useful} ${CURL_SOURCE_DIR}/lib/inet_pton.c)
  70. # setup_executable(getpart testpart.c ${useful})
  71. # setup_executable(tftpd tftpd.c util.c util.h ${useful} tftp.h)