diff options
author | Luke T. Shumaker <lukeshu@lukeshu.com> | 2025-03-26 20:47:05 -0600 |
---|---|---|
committer | Luke T. Shumaker <lukeshu@lukeshu.com> | 2025-03-26 20:47:05 -0600 |
commit | 61b14883c1ddbd5985c681ef7b559cf3c8c15525 (patch) | |
tree | b27a8c7d948c121f81486178ad77df577b83ab0d | |
parent | f7eb78bd9f38294814c05bcf7867ce6c4414c77c (diff) |
cmake: Fuss with include_directories for tests
-rw-r--r-- | CMakeLists.txt | 1 | ||||
-rw-r--r-- | libcr_ipc/CMakeLists.txt | 9 |
2 files changed, 4 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 386b13c..c7bf993 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -98,6 +98,7 @@ function(add_lib_test arg_libname arg_testname) if (ENABLE_TESTS) add_executable("${arg_testname}" "tests/${arg_testname}.c") target_link_libraries("${arg_testname}" "${arg_libname}") + target_include_directories("${arg_testname}" PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/tests) add_test( NAME "${arg_libname}/${arg_testname}" COMMAND valgrind --error-exitcode=2 "./${arg_testname}" diff --git a/libcr_ipc/CMakeLists.txt b/libcr_ipc/CMakeLists.txt index 4590bdd..3746584 100644 --- a/libcr_ipc/CMakeLists.txt +++ b/libcr_ipc/CMakeLists.txt @@ -21,9 +21,6 @@ set(ipc_tests rpc sema ) -if (ENABLE_TESTS) - foreach(test IN LISTS ipc_tests) - add_lib_test(libcr_ipc "test_${test}") - target_include_directories("test_${test}" PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/tests) - endforeach() -endif() +foreach(test IN LISTS ipc_tests) + add_lib_test(libcr_ipc "test_${test}") +endforeach() |