| 1 | This patch prevents iniparser from fetching external dependencies on build
|
| 2 | phase.
|
| 3 | This patch has been taken from nixpkgs' iniparser package:
|
| 4 | https://github.com/NixOS/nixpkgs/blob/3497aa5c9457a9d88d71fa93a4a8368816fbeeba/pkgs/by-name/in/iniparser/remove-fetchcontent-usage.patch
|
| 5 |
|
| 6 | diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
|
| 7 | index 0735d27..32c5cdb 100644
|
| 8 | |
| 9 | |
| 10 | @@ -26,16 +26,8 @@ endif()
|
| 11 |
|
| 12 | set(FETCHCONTENT_QUIET OFF)
|
| 13 |
|
| 14 | -FetchContent_Declare(
|
| 15 | - unity
|
| 16 | - GIT_REPOSITORY "https://github.com/throwtheswitch/unity.git"
|
| 17 | - GIT_PROGRESS TRUE
|
| 18 | - PATCH_COMMAND ${CMAKE_COMMAND} -E copy
|
| 19 | - ${CMAKE_CURRENT_LIST_DIR}/unity_config.h ./src/)
|
| 20 | -
|
| 21 | -FetchContent_MakeAvailable(unity)
|
| 22 | -target_compile_definitions(unity PUBLIC UNITY_INCLUDE_CONFIG_H
|
| 23 | - UNITY_USE_COMMAND_LINE_ARGS)
|
| 24 | +find_package(PkgConfig REQUIRED)
|
| 25 | +pkg_check_modules(UNITY REQUIRED unity)
|
| 26 |
|
| 27 | function(create_test_runner)
|
| 28 | set(options)
|
| 29 | @@ -52,7 +44,7 @@ function(create_test_runner)
|
| 30 | add_custom_command(
|
| 31 | OUTPUT test_${TEST_RUNNER_NAME}_runner.c
|
| 32 | COMMAND
|
| 33 | - ${RUBY_EXECUTABLE} ${unity_SOURCE_DIR}/auto/generate_test_runner.rb
|
| 34 | + @UNITY-GENERATE-TEST-RUNNER@
|
| 35 | ${CMAKE_CURRENT_SOURCE_DIR}/test_${TEST_RUNNER_NAME}.c
|
| 36 | test_${TEST_RUNNER_NAME}_runner.c ${CMAKE_CURRENT_LIST_DIR}/unity-config.yml
|
| 37 | DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/test_${TEST_RUNNER_NAME}.c
|
| 38 | @@ -62,10 +54,18 @@ function(create_test_runner)
|
| 39 | test_${TEST_RUNNER_NAME}_runner.c)
|
| 40 | foreach(TARGET_TYPE ${TARGET_TYPES})
|
| 41 | # if BUILD_STATIC_LIBS=ON shared takes precedence
|
| 42 | + target_include_directories(
|
| 43 | + test_${TEST_RUNNER_NAME}
|
| 44 | + PUBLIC
|
| 45 | + ${UNITY_INCLUDE_DIRS})
|
| 46 | + target_compile_options(
|
| 47 | + test_${TEST_RUNNER_NAME}
|
| 48 | + PUBLIC
|
| 49 | + ${UNITY_CFLAGS_OTHER})
|
| 50 | target_link_libraries(
|
| 51 | test_${TEST_RUNNER_NAME}
|
| 52 | ${PROJECT_NAME}-${TARGET_TYPE}
|
| 53 | - unity)
|
| 54 | + ${UNITY_LIBRARIES})
|
| 55 | endforeach()
|
| 56 | endfunction()
|
| 57 |
|