2
0

CMakeLists.txt 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. # Get 'UNITPROGS', '*_SOURCES', 'FIRSTFILES' variables
  25. transform_makefile_inc("Makefile.inc" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
  26. include("${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
  27. if(CURL_TEST_BUNDLES)
  28. add_custom_command(
  29. OUTPUT "unit_bundle.c"
  30. COMMAND ${PERL_EXECUTABLE} "${CURL_SOURCE_DIR}/tests/mk-bundle.pl" "${CMAKE_CURRENT_SOURCE_DIR}" > "unit_bundle.c"
  31. DEPENDS
  32. "${CURL_SOURCE_DIR}/tests/mk-bundle.pl" ${FIRSTFILES}
  33. "${CMAKE_CURRENT_SOURCE_DIR}/Makefile.inc"
  34. VERBATIM)
  35. set(UNITPROGS "units")
  36. set(units_SOURCES "unit_bundle.c")
  37. endif()
  38. foreach(_target IN LISTS UNITPROGS)
  39. set(_target_name "${_target}")
  40. add_executable(${_target_name} EXCLUDE_FROM_ALL ${${_target}_SOURCES})
  41. add_dependencies(testdeps ${_target_name})
  42. target_link_libraries(${_target_name} curltool curlu)
  43. target_include_directories(${_target_name} PRIVATE
  44. "${CURL_BINARY_DIR}/lib" # for "curl_config.h"
  45. "${CURL_SOURCE_DIR}/lib" # for "curl_setup.h"
  46. "${CURL_SOURCE_DIR}/src"
  47. "${CURL_SOURCE_DIR}/tests/libtest"
  48. )
  49. if(CURL_TEST_BUNDLES)
  50. target_include_directories(${_target_name} PRIVATE "${CURL_SOURCE_DIR}/tests/unit")
  51. endif()
  52. set_target_properties(${_target_name} PROPERTIES
  53. OUTPUT_NAME "${_target}"
  54. PROJECT_LABEL "Test unit ${_target}")
  55. endforeach()