{"thread":{"id":"63898","subject":"[PATCH] cmake: accommodate for `UNIT_TEST_SOURCES`","startedAt":"2025-08-03T21:24:30Z","lastAt":"2025-08-17T16:12:38Z","messageCount":3,"participants":["Johannes Schindelin via GitGitGadget","Johannes Schindelin","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"523355","messageId":"pull.1947.git.1754256267117.gitgitgadget@gmail.com","threadId":"63898","inReplyTo":null,"subject":"[PATCH] cmake: accommodate for `UNIT_TEST_SOURCES`","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2025-08-03T21:24:26Z","receivedAt":"2025-08-03T21:24:30Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nAs part of 9bbc981c6f2 (t/unit-tests: finalize migration of\nreftable-related tests, 2025-07-24), the explicit list of\n`UNIT_TEST_PROGRAMS` was turned into a wildcard pattern-derived list.\n\nLet's do the same in the CMake definition.\n\nThis fixes build errors with symptoms like this:\n\n  CMake Error at CMakeLists.txt:132 (string):\n    string sub-command REPLACE requires at least four arguments.\n  Call Stack (most recent call first):\n    CMakeLists.txt:1037 (parse_makefile_for_scripts)\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n    cmake: accommodate for UNIT_TEST_SOURCES\n    \n    This fix is needed to build Git using CMake in the wake of the recent\n    migration of the reftable tests from being regression tests written in\n    Unix shell script to being unit tests in pure C.\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-1947%2Fdscho%2Freftable-vs-cmake-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1947/dscho/reftable-vs-cmake-v1\nPull-Request: https://github.com/gitgitgadget/git/pull/1947\n\n contrib/buildsystems/CMakeLists.txt | 4 +++-\n 1 file changed, 3 insertions(+), 1 deletion(-)\n\ndiff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt\nindex 25b495fa737..edb0fc04ad7 100644\n--- a/contrib/buildsystems/CMakeLists.txt\n+++ b/contrib/buildsystems/CMakeLists.txt\n@@ -1005,7 +1005,9 @@ parse_makefile_for_sources(clar-test_SOURCES ${CMAKE_SOURCE_DIR}/Makefile \"CLAR_\n list(TRANSFORM clar-test_SOURCES REPLACE \"\\\\$\\\\(UNIT_TEST_DIR\\\\)/\" \"${CMAKE_SOURCE_DIR}/t/unit-tests/\")\n add_library(clar-test-lib STATIC ${clar-test_SOURCES})\n \n-parse_makefile_for_scripts(unit_test_PROGRAMS \"UNIT_TEST_PROGRAMS\" \"\")\n+file(GLOB unit_test_PROGRAMS \"${CMAKE_SOURCE_DIR}/t/unit-tests/t-*.c\")\n+list(TRANSFORM unit_test_PROGRAMS REPLACE \"${CMAKE_SOURCE_DIR}/\" \"\")\n+list(TRANSFORM unit_test_PROGRAMS REPLACE \".c\" \"\")\n foreach(unit_test ${unit_test_PROGRAMS})\n \tadd_executable(\"${unit_test}\" \"${CMAKE_SOURCE_DIR}/t/unit-tests/${unit_test}.c\")\n \ttarget_link_libraries(\"${unit_test}\" unit-test-lib clar-test-lib common-main)\n\nbase-commit: 866e6a391f466baeeb98bc585845ea638322c04b\n-- \ngitgitgadget\n"},{"id":"524294","messageId":"3a5e72a3-ae92-5fa7-2bf8-4276afcfd863@gmx.de","threadId":"63898","inReplyTo":"pull.1947.git.1754256267117.gitgitgadget@gmail.com","subject":"Re: [PATCH] cmake: accommodate for `UNIT_TEST_SOURCES`","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2025-08-16T17:09:28Z","receivedAt":"2025-08-16T17:09:31Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Junio,\n\nthis patch is still required; I sent this before -rc0 was released so that\nit could be included in v2.51.0 final. Could you please still merge it?\n\nThanks,\nJohannes\n\nOn Sun, 3 Aug 2025, Johannes Schindelin via GitGitGadget wrote:\n\n> From: Johannes Schindelin <johannes.schindelin@gmx.de>\n> \n> As part of 9bbc981c6f2 (t/unit-tests: finalize migration of\n> reftable-related tests, 2025-07-24), the explicit list of\n> `UNIT_TEST_PROGRAMS` was turned into a wildcard pattern-derived list.\n> \n> Let's do the same in the CMake definition.\n> \n> This fixes build errors with symptoms like this:\n> \n>   CMake Error at CMakeLists.txt:132 (string):\n>     string sub-command REPLACE requires at least four arguments.\n>   Call Stack (most recent call first):\n>     CMakeLists.txt:1037 (parse_makefile_for_scripts)\n> \n> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n> ---\n>     cmake: accommodate for UNIT_TEST_SOURCES\n>     \n>     This fix is needed to build Git using CMake in the wake of the recent\n>     migration of the reftable tests from being regression tests written in\n>     Unix shell script to being unit tests in pure C.\n> \n> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1947%2Fdscho%2Freftable-vs-cmake-v1\n> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1947/dscho/reftable-vs-cmake-v1\n> Pull-Request: https://github.com/gitgitgadget/git/pull/1947\n> \n>  contrib/buildsystems/CMakeLists.txt | 4 +++-\n>  1 file changed, 3 insertions(+), 1 deletion(-)\n> \n> diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt\n> index 25b495fa737..edb0fc04ad7 100644\n> --- a/contrib/buildsystems/CMakeLists.txt\n> +++ b/contrib/buildsystems/CMakeLists.txt\n> @@ -1005,7 +1005,9 @@ parse_makefile_for_sources(clar-test_SOURCES ${CMAKE_SOURCE_DIR}/Makefile \"CLAR_\n>  list(TRANSFORM clar-test_SOURCES REPLACE \"\\\\$\\\\(UNIT_TEST_DIR\\\\)/\" \"${CMAKE_SOURCE_DIR}/t/unit-tests/\")\n>  add_library(clar-test-lib STATIC ${clar-test_SOURCES})\n>  \n> -parse_makefile_for_scripts(unit_test_PROGRAMS \"UNIT_TEST_PROGRAMS\" \"\")\n> +file(GLOB unit_test_PROGRAMS \"${CMAKE_SOURCE_DIR}/t/unit-tests/t-*.c\")\n> +list(TRANSFORM unit_test_PROGRAMS REPLACE \"${CMAKE_SOURCE_DIR}/\" \"\")\n> +list(TRANSFORM unit_test_PROGRAMS REPLACE \".c\" \"\")\n>  foreach(unit_test ${unit_test_PROGRAMS})\n>  \tadd_executable(\"${unit_test}\" \"${CMAKE_SOURCE_DIR}/t/unit-tests/${unit_test}.c\")\n>  \ttarget_link_libraries(\"${unit_test}\" unit-test-lib clar-test-lib common-main)\n> \n> base-commit: 866e6a391f466baeeb98bc585845ea638322c04b\n> -- \n> gitgitgadget\n> \n> \n"},{"id":"524322","messageId":"xmqqbjoekjv0.fsf@gitster.g","threadId":"63898","inReplyTo":"3a5e72a3-ae92-5fa7-2bf8-4276afcfd863@gmx.de","subject":"Re: [PATCH] cmake: accommodate for `UNIT_TEST_SOURCES`","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-08-17T16:12:35Z","receivedAt":"2025-08-17T16:12:38Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n> Hi Junio,\n>\n> this patch is still required; I sent this before -rc0 was released so that\n> it could be included in v2.51.0 final. Could you please still merge it?\n>\n> Thanks,\n> Johannes\n\nThanks for pinging.  With so much traffic, a single patch without\nany discussion thread went completely under the rader.\n\nWill apply directly to 'master'.\n\n"}]}