From 48c294105f5123dc876fbad199ec1e0166d82a18 Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Tue, 23 Dec 2025 11:59:45 +0100 Subject: build: Refactor CMake modules This moves the CMake build logic out of the source tree and splits it up into a more modular form. The tests now have a CMakeLists.txt file in their respective source directory. Signed-off-by: Dimitri Staessens Signed-off-by: Sander Vrijders --- src/irmd/reg/CMakeLists.txt | 9 --------- src/irmd/reg/tests/CMakeLists.txt | 10 +++++++++- 2 files changed, 9 insertions(+), 10 deletions(-) delete mode 100644 src/irmd/reg/CMakeLists.txt (limited to 'src/irmd/reg') diff --git a/src/irmd/reg/CMakeLists.txt b/src/irmd/reg/CMakeLists.txt deleted file mode 100644 index d3844908..00000000 --- a/src/irmd/reg/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -include_directories(${CMAKE_CURRENT_SOURCE_DIR}) -include_directories(${CMAKE_CURRENT_BINARY_DIR}) - -include_directories(${CMAKE_SOURCE_DIR}/include) -include_directories(${CMAKE_BINARY_DIR}/include) - -if(BUILD_TESTS) - add_subdirectory(tests) -endif () diff --git a/src/irmd/reg/tests/CMakeLists.txt b/src/irmd/reg/tests/CMakeLists.txt index d2907a93..eb7a1765 100644 --- a/src/irmd/reg/tests/CMakeLists.txt +++ b/src/irmd/reg/tests/CMakeLists.txt @@ -1,6 +1,14 @@ get_filename_component(tmp ".." ABSOLUTE) get_filename_component(src_folder "${tmp}" NAME) +# Set include directories for tests +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) +include_directories(${CMAKE_CURRENT_BINARY_DIR}) +include_directories(${CMAKE_SOURCE_DIR}/include) +include_directories(${CMAKE_BINARY_DIR}/include) +include_directories(${CMAKE_SOURCE_DIR}/src/irmd) +include_directories(${CMAKE_BINARY_DIR}/src/irmd) + create_test_sourcelist(${src_folder}_tests test_suite.c # Add new tests here flow_test.c @@ -29,5 +37,5 @@ endif() foreach(test ${tests_to_run}) get_filename_component(test_name ${test} NAME_WE) - add_test(irmd/reg/${test_name} ${C_TEST_PATH}/${src_folder}_test ${test_name}) + add_test(irmd/reg/${test_name} ${CMAKE_CURRENT_BINARY_DIR}/${src_folder}_test ${test_name}) endforeach(test) -- cgit v1.2.3