quickjs-tart

quickjs-based runtime for wallet-core logic
Log | Files | Refs | README | LICENSE

CMakeLists.txt (2713B)


      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(${BUNDLE} curlu-unitprotos)
     39 add_dependencies(testdeps ${BUNDLE})
     40 target_link_libraries(${BUNDLE} curlu)
     41 target_include_directories(${BUNDLE} PRIVATE
     42   "${PROJECT_BINARY_DIR}/lib"            # for "curl_config.h", "unitprotos.h"
     43   "${PROJECT_SOURCE_DIR}/lib"            # for "curl_setup.h", curlx
     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 # unit tests are small pretend-libcurl-programs
     50 set_property(TARGET ${BUNDLE} APPEND PROPERTY COMPILE_DEFINITIONS "BUILDING_LIBCURL")
     51 set_target_properties(${BUNDLE} PROPERTIES OUTPUT_NAME "${BUNDLE}" PROJECT_LABEL "Test ${BUNDLE}" UNITY_BUILD OFF C_CLANG_TIDY "")
     52 
     53 curl_add_clang_tidy_test_target("${BUNDLE}-clang-tidy" ${BUNDLE} ${FIRST_C} ${TESTS_C})
     54 if(TARGET "${BUNDLE}-clang-tidy")
     55   add_dependencies("${BUNDLE}-clang-tidy" curlu-unitprotos)
     56 endif()