quickjs-tart

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

CMakeLists.txt (2916B)


      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 if(LIB_SELECTED STREQUAL LIB_STATIC)
     30   set(CURLX_C "")  # Already exported from the libcurl static build. Skip them.
     31 endif()
     32 
     33 add_custom_command(OUTPUT "lib1521.c"
     34   COMMAND ${PERL_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/mk-lib1521.pl" < "${PROJECT_SOURCE_DIR}/include/curl/curl.h" "lib1521.c"
     35   DEPENDS
     36     "${CMAKE_CURRENT_SOURCE_DIR}/mk-lib1521.pl"
     37     "${PROJECT_SOURCE_DIR}/include/curl/curl.h"
     38   VERBATIM)
     39 
     40 list(APPEND TESTS_C "lib1521.c")
     41 
     42 add_custom_command(OUTPUT "${BUNDLE}.c"
     43   COMMAND ${PERL_EXECUTABLE} "${PROJECT_SOURCE_DIR}/scripts/mk-unity.pl"
     44     --include ${UTILS_C} ${CURLX_C} --test ${TESTS_C} > "${BUNDLE}.c"
     45   DEPENDS
     46     "${PROJECT_SOURCE_DIR}/scripts/mk-unity.pl" "${CMAKE_CURRENT_SOURCE_DIR}/Makefile.inc"
     47     ${FIRST_C} ${UTILS_C} ${CURLX_C} ${TESTS_C}
     48   VERBATIM)
     49 
     50 add_executable(${BUNDLE} EXCLUDE_FROM_ALL "${BUNDLE}.c")
     51 add_dependencies(testdeps ${BUNDLE})
     52 target_link_libraries(${BUNDLE} ${LIB_SELECTED} ${CURL_LIBS})
     53 target_include_directories(${BUNDLE} PRIVATE
     54   "${PROJECT_BINARY_DIR}/lib"            # for "curl_config.h"
     55   "${PROJECT_SOURCE_DIR}/lib"            # for "curl_setup.h", curlx
     56   "${CMAKE_CURRENT_SOURCE_DIR}"          # for the generated bundle source to find included test sources
     57 )
     58 set_property(TARGET ${BUNDLE} APPEND PROPERTY COMPILE_DEFINITIONS "${CURL_DEBUG_MACROS}")
     59 set_property(TARGET ${BUNDLE} APPEND PROPERTY COMPILE_DEFINITIONS "CURL_NO_OLDIES" "CURL_DISABLE_DEPRECATION")
     60 set_target_properties(${BUNDLE} PROPERTIES OUTPUT_NAME "${BUNDLE}" PROJECT_LABEL "Test ${BUNDLE}" UNITY_BUILD OFF C_CLANG_TIDY "")
     61 
     62 curl_add_clang_tidy_test_target("${BUNDLE}-clang-tidy" ${BUNDLE} ${FIRST_C} ${UTILS_C} ${TESTS_C})