CMakeLists.txt (2495B)
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 25 # Get BUNDLE, FIRST_C, TESTS_C variables 26 curl_transform_makefile_inc("Makefile.inc" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake") 27 include("${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake") 28 29 add_custom_command(OUTPUT "${BUNDLE}.c" 30 COMMAND ${PERL_EXECUTABLE} "${PROJECT_SOURCE_DIR}/scripts/mk-unity.pl" 31 --test ${TESTS_C} > "${BUNDLE}.c" 32 DEPENDS 33 "${PROJECT_SOURCE_DIR}/scripts/mk-unity.pl" "${CMAKE_CURRENT_SOURCE_DIR}/Makefile.inc" 34 ${FIRST_C} ${TESTS_C} 35 VERBATIM) 36 37 add_executable(${BUNDLE} EXCLUDE_FROM_ALL "${BUNDLE}.c") 38 add_dependencies(testdeps ${BUNDLE}) 39 target_link_libraries(${BUNDLE} curltool ${LIB_SELECTED}) 40 target_include_directories(${BUNDLE} PRIVATE 41 "${PROJECT_BINARY_DIR}/lib" # for "curl_config.h" 42 "${PROJECT_SOURCE_DIR}/lib" # for "curl_setup.h", curlx 43 "${PROJECT_SOURCE_DIR}/src" # for tool headers 44 "${PROJECT_SOURCE_DIR}/tests/libtest" # for "first.h", "unitcheck.h" 45 "${CMAKE_CURRENT_SOURCE_DIR}" # for the generated bundle source to find included test sources 46 ) 47 set_property(TARGET ${BUNDLE} APPEND PROPERTY COMPILE_DEFINITIONS "${CURL_DEBUG_MACROS}") 48 set_property(TARGET ${BUNDLE} APPEND PROPERTY COMPILE_DEFINITIONS "CURL_NO_OLDIES" "CURL_DISABLE_DEPRECATION") 49 set_target_properties(${BUNDLE} PROPERTIES OUTPUT_NAME "${BUNDLE}" PROJECT_LABEL "Test ${BUNDLE}" UNITY_BUILD OFF C_CLANG_TIDY "") 50 51 curl_add_clang_tidy_test_target("${BUNDLE}-clang-tidy" ${BUNDLE} ${FIRST_C} ${TESTS_C})