cmake: let `test-tool` run the unit tests, too

The `test-tool` recently learned to run the unit tests. To this end, it needs to link with `test-lib.c`, which was done in the `Makefile`, and this patch does it in the CMake definition, too. This is a companion of 44400f58407e (t0080: turn t-basic unit test into a helper, 2024-02-02). Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Johannes Schindelin committed Feb 15, 2024 at 23:15 UTC 951105664dd4de73a8c949b0fb875e895d149ece
1 file changed +2 -1
contrib/buildsystems/CMakeLists.txt
+2 -1
@@ -1005,10 +1005,11 @@ endforeach()
1005
1006 #test-tool
1007 parse_makefile_for_sources(test-tool_SOURCES "TEST_BUILTINS_OBJS")
1008 +add_library(test-lib OBJECT ${CMAKE_SOURCE_DIR}/t/unit-tests/test-lib.c)
1009
1010 list(TRANSFORM test-tool_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/t/helper/")
1011 add_executable(test-tool ${CMAKE_SOURCE_DIR}/t/helper/test-tool.c ${test-tool_SOURCES} ${test-reftable_SOURCES})
1011 -target_link_libraries(test-tool common-main)
1012 +target_link_libraries(test-tool test-lib common-main)
1013
1014 set_target_properties(test-fake-ssh test-tool
1015 PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/t/helper)