Skip to content

Commit d7cf2a7

Browse files
dschoGit for Windows Build Agent
authored andcommitted
cmake: accommodate for UNIT_TEST_SOURCES
As part of 9bbc981 (t/unit-tests: finalize migration of reftable-related tests, 2025-07-24), the explicit list of `UNIT_TEST_PROGRAMS` was turned into a wildcard pattern-derived list. Let's do the same in the CMake definition. This fixes build errors with symptoms like this: CMake Error at CMakeLists.txt:132 (string): string sub-command REPLACE requires at least four arguments. Call Stack (most recent call first): CMakeLists.txt:1037 (parse_makefile_for_scripts) Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 0445434 commit d7cf2a7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

contrib/buildsystems/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1034,7 +1034,9 @@ parse_makefile_for_sources(clar-test_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "CLAR_
10341034
list(TRANSFORM clar-test_SOURCES REPLACE "\\$\\(UNIT_TEST_DIR\\)/" "${CMAKE_SOURCE_DIR}/t/unit-tests/")
10351035
add_library(clar-test-lib STATIC ${clar-test_SOURCES})
10361036

1037-
parse_makefile_for_scripts(unit_test_PROGRAMS "UNIT_TEST_PROGRAMS" "")
1037+
file(GLOB unit_test_PROGRAMS "${CMAKE_SOURCE_DIR}/t/unit-tests/t-*.c")
1038+
list(TRANSFORM unit_test_PROGRAMS REPLACE "${CMAKE_SOURCE_DIR}/" "")
1039+
list(TRANSFORM unit_test_PROGRAMS REPLACE ".c" "")
10381040
foreach(unit_test ${unit_test_PROGRAMS})
10391041
add_executable("${unit_test}" "${CMAKE_SOURCE_DIR}/t/unit-tests/${unit_test}.c")
10401042
target_link_libraries("${unit_test}" unit-test-lib clar-test-lib common-main)

0 commit comments

Comments
 (0)