~ruther/guix-local

ref: next-master guix-local/gnu/packages/patches/iniparser-remove-fetchcontent-usage.patch -rw-r--r-- 2.0 KiB
b989e013 — Andy Tai gnu: koboldcpp: Update to 1.106.2. 30 days ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
This patch prevents iniparser from fetching external dependencies on build
phase.
This patch has been taken from nixpkgs' iniparser package:
https://github.com/NixOS/nixpkgs/blob/3497aa5c9457a9d88d71fa93a4a8368816fbeeba/pkgs/by-name/in/iniparser/remove-fetchcontent-usage.patch

diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 0735d27..32c5cdb 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -26,16 +26,8 @@ endif()
 
 set(FETCHCONTENT_QUIET OFF)
 
-FetchContent_Declare(
-  unity
-  GIT_REPOSITORY "https://github.com/throwtheswitch/unity.git"
-  GIT_PROGRESS TRUE
-  PATCH_COMMAND ${CMAKE_COMMAND} -E copy
-                ${CMAKE_CURRENT_LIST_DIR}/unity_config.h ./src/)
-
-FetchContent_MakeAvailable(unity)
-target_compile_definitions(unity PUBLIC UNITY_INCLUDE_CONFIG_H
-                                        UNITY_USE_COMMAND_LINE_ARGS)
+find_package(PkgConfig REQUIRED)
+pkg_check_modules(UNITY REQUIRED unity)
 
 function(create_test_runner)
   set(options)
@@ -52,7 +44,7 @@ function(create_test_runner)
   add_custom_command(
     OUTPUT test_${TEST_RUNNER_NAME}_runner.c
     COMMAND
-      ${RUBY_EXECUTABLE} ${unity_SOURCE_DIR}/auto/generate_test_runner.rb
+      @UNITY-GENERATE-TEST-RUNNER@
       ${CMAKE_CURRENT_SOURCE_DIR}/test_${TEST_RUNNER_NAME}.c
       test_${TEST_RUNNER_NAME}_runner.c ${CMAKE_CURRENT_LIST_DIR}/unity-config.yml
     DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/test_${TEST_RUNNER_NAME}.c
@@ -62,10 +54,18 @@ function(create_test_runner)
                                           test_${TEST_RUNNER_NAME}_runner.c)
   foreach(TARGET_TYPE ${TARGET_TYPES})
     # if BUILD_STATIC_LIBS=ON shared takes precedence
+    target_include_directories(
+      test_${TEST_RUNNER_NAME}
+      PUBLIC
+      ${UNITY_INCLUDE_DIRS})
+    target_compile_options(
+      test_${TEST_RUNNER_NAME}
+      PUBLIC
+      ${UNITY_CFLAGS_OTHER})
     target_link_libraries(
       test_${TEST_RUNNER_NAME}
       ${PROJECT_NAME}-${TARGET_TYPE}
-      unity)
+      ${UNITY_LIBRARIES})
   endforeach()
 endfunction()