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