CMakeLists.txt (2941B)
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, FIRST_H, UTILS_C, UTILS_H, CURLX_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 --include ${UTILS_C} ${CURLX_C} --test ${TESTS_C} > "${BUNDLE}.c" 32 DEPENDS 33 "${PROJECT_SOURCE_DIR}/scripts/mk-unity.pl" "${CMAKE_CURRENT_SOURCE_DIR}/Makefile.inc" 34 ${FIRST_C} ${UTILS_C} ${CURLX_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} ${CURL_LIBS}) 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 "${CMAKE_CURRENT_SOURCE_DIR}" # for the generated bundle source to find included test sources 44 ) 45 set_property(TARGET ${BUNDLE} APPEND PROPERTY COMPILE_DEFINITIONS "WITHOUT_LIBCURL") 46 set_property(TARGET ${BUNDLE} APPEND PROPERTY COMPILE_DEFINITIONS "CURL_NO_OLDIES") 47 # Test servers simply are standalone programs that do not use libcurl 48 # library. For convenience and to ease portability of these servers, 49 # some source code files from the libcurl subdirectory are also used 50 # to build the servers. In order to achieve proper linkage of these 51 # files on Windows targets it is necessary to build the test servers 52 # with CURL_STATICLIB defined, independently of how libcurl is built. 53 if(WIN32) 54 set_property(TARGET ${BUNDLE} APPEND PROPERTY COMPILE_DEFINITIONS "CURL_STATICLIB") 55 endif() 56 set_target_properties(${BUNDLE} PROPERTIES OUTPUT_NAME "${BUNDLE}" PROJECT_LABEL "Test ${BUNDLE}" UNITY_BUILD OFF C_CLANG_TIDY "") 57 58 curl_add_clang_tidy_test_target("${BUNDLE}-clang-tidy" ${BUNDLE} ${FIRST_C} ${UTILS_C} ${TESTS_C})