From ce2b8755c6aa4101b0c4c4e097c7bc71493594c0 Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Sat, 6 Apr 2024 14:36:37 +0200 Subject: build: Fix tests with CMake >= 3.29 Removing the testdriver source by the driver name doesn't work anymore in CMake 3.29 because of the following (breaking) change: Changed in version 3.29: The test driver source is listed by absolute path in the build tree. Previously it was listed only as . https://cmake.org/cmake/help/latest/command/create_test_sourcelist.html When using CMake 3.29 or above, Ouroboros will use the list POP_FRONT function (introduced in CMake 3.15) to get rid of it. https://cmake.org/cmake/help/latest/command/list.html#pop-front Signed-off-by: Dimitri Staessens Signed-off-by: Sander Vrijders --- src/irmd/reg/tests/CMakeLists.txt | 6 +++++- src/irmd/tests/CMakeLists.txt | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'src/irmd') diff --git a/src/irmd/reg/tests/CMakeLists.txt b/src/irmd/reg/tests/CMakeLists.txt index bc1354ed..7bc98571 100644 --- a/src/irmd/reg/tests/CMakeLists.txt +++ b/src/irmd/reg/tests/CMakeLists.txt @@ -21,7 +21,11 @@ endif () add_dependencies(check ${src_folder}_test) set(tests_to_run ${${src_folder}_tests}) -remove(tests_to_run test_suite.c) +if(CMAKE_VERSION VERSION_LESS "3.29.0") + remove(tests_to_run test_suite.c) +else () + list(POP_FRONT tests_to_run) +endif() foreach(test ${tests_to_run}) get_filename_component(test_name ${test} NAME_WE) diff --git a/src/irmd/tests/CMakeLists.txt b/src/irmd/tests/CMakeLists.txt index e005d194..99743052 100644 --- a/src/irmd/tests/CMakeLists.txt +++ b/src/irmd/tests/CMakeLists.txt @@ -11,7 +11,11 @@ target_link_libraries(${src_folder}_test ouroboros-common) add_dependencies(check ${src_folder}_test) set(tests_to_run ${${src_folder}_tests}) -remove(tests_to_run test_suite.c) +if(CMAKE_VERSION VERSION_LESS "3.29.0") + remove(tests_to_run test_suite.c) +else () + list(POP_FRONT tests_to_run) +endif() foreach(test ${tests_to_run}) get_filename_component(test_name ${test} NAME_WE) -- cgit v1.2.3