From f8509d9ee1548ddc4c13ece7aea0d4c2b8c1dc29 Mon Sep 17 00:00:00 2001 From: Philippe Canal Date: Fri, 20 Feb 2026 15:40:55 -0600 Subject: [PATCH 1/5] cmake: Include VStudio in the `Ninja` `RESOURCE_LOCK`. When using the Microsoft Visual Studio generator we have the exact same problem, that it might trigger a rebuild of ROOT so we need to apply the same solution. See 06e00a270e6e4f1157bfc344ad0dcdb6c45bb01a. PS. We might want to eventually rename the resource lock. Add missing config to the build target (required on Windows) --- cmake/modules/RootCTest.cmake | 12 ++++++++---- cmake/modules/RootMacros.cmake | 6 +++--- roottest/cling/dict/ROOT-8096/CMakeLists.txt | 2 +- roottest/cling/stl/dicts/CMakeLists.txt | 2 +- roottest/root/io/rootcint/sigbug/CMakeLists.txt | 2 +- roottest/root/io/tmpifile/CMakeLists.txt | 2 +- roottest/root/io/transient/base/CMakeLists.txt | 2 +- .../root/meta/genreflex/ROOT-5768/CMakeLists.txt | 2 +- 8 files changed, 17 insertions(+), 13 deletions(-) diff --git a/cmake/modules/RootCTest.cmake b/cmake/modules/RootCTest.cmake index e434770ce0729..93c55f3c4cedd 100644 --- a/cmake/modules/RootCTest.cmake +++ b/cmake/modules/RootCTest.cmake @@ -51,15 +51,19 @@ foreach(d ${test_list}) endif() endforeach() -# When ninja is in use, tests that compile an executable might try to rebuild the entire build tree. -# If multiple of these are invoked in parallel, ninja will suffer from race conditions. +# When ninja or the Microsoft generator are in use, tests that compile an executable might try +# to rebuild the entire build tree. If multiple of these are invoked in parallel, ninja will +# suffer from race conditions. # To solve this, do the following: # - Add a test that updates the build tree (equivalent to "ninja all"). This one will run in complete isolation. # - Make all tests that require a ninja build depend on the above test. # - Use a RESOURCE_LOCK on all tests that invoke ninja, so no two tests will invoke ninja in parallel -if(CMAKE_GENERATOR MATCHES Ninja) +if(CMAKE_GENERATOR MATCHES Ninja OR CMAKE_GENERATOR MATCHES "Visual Studio") + if (${build_configuration}) + set(cmake_build_all_select_config --config ${build_configuration}) + endif() add_test(NAME ninja-build-all - COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR}) + COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} ${cmake_build_all_select_config}) set_tests_properties(ninja-build-all PROPERTIES RESOURCE_LOCK NINJA_BUILD FIXTURES_SETUP NINJA_BUILD_ALL diff --git a/cmake/modules/RootMacros.cmake b/cmake/modules/RootMacros.cmake index 1fc36f5899169..82bc39e1b0523 100644 --- a/cmake/modules/RootMacros.cmake +++ b/cmake/modules/RootMacros.cmake @@ -2641,7 +2641,7 @@ macro(ROOTTEST_GENERATE_DICTIONARY dictname) -- ${always-make}) set_property(TEST ${GENERATE_DICTIONARY_TEST} PROPERTY ENVIRONMENT ${ROOTTEST_ENVIRONMENT}) - if(CMAKE_GENERATOR MATCHES Ninja) + if(CMAKE_GENERATOR MATCHES Ninja OR CMAKE_GENERATOR MATCHES "Visual Studio") set_property(TEST ${GENERATE_DICTIONARY_TEST} APPEND PROPERTY RESOURCE_LOCK NINJA_BUILD) set_property(TEST ${GENERATE_DICTIONARY_TEST} APPEND PROPERTY FIXTURES_REQUIRED NINJA_BUILD_ALL) endif() @@ -2749,7 +2749,7 @@ macro(ROOTTEST_GENERATE_REFLEX_DICTIONARY dictionary) -- ${always-make}) set_property(TEST ${GENERATE_REFLEX_TEST} PROPERTY ENVIRONMENT ${ROOTTEST_ENVIRONMENT}) - if(CMAKE_GENERATOR MATCHES Ninja) + if(CMAKE_GENERATOR MATCHES Ninja OR CMAKE_GENERATOR MATCHES "Visual Studio") set_property(TEST ${GENERATE_REFLEX_TEST} APPEND PROPERTY RESOURCE_LOCK NINJA_BUILD) set_property(TEST ${GENERATE_REFLEX_TEST} APPEND PROPERTY FIXTURES_REQUIRED NINJA_BUILD_ALL) endif() @@ -2861,7 +2861,7 @@ macro(ROOTTEST_GENERATE_EXECUTABLE executable) RESOURCE_LOCK ${ARG_RESOURCE_LOCK}) endif() - if(CMAKE_GENERATOR MATCHES Ninja) + if(CMAKE_GENERATOR MATCHES Ninja OR CMAKE_GENERATOR MATCHES "Visual Studio") set_property(TEST ${GENERATE_EXECUTABLE_TEST} APPEND PROPERTY RESOURCE_LOCK NINJA_BUILD) set_property(TEST ${GENERATE_EXECUTABLE_TEST} APPEND PROPERTY FIXTURES_REQUIRED NINJA_BUILD_ALL) endif() diff --git a/roottest/cling/dict/ROOT-8096/CMakeLists.txt b/roottest/cling/dict/ROOT-8096/CMakeLists.txt index 07c916ce01b19..b88a0b9ff1a66 100644 --- a/roottest/cling/dict/ROOT-8096/CMakeLists.txt +++ b/roottest/cling/dict/ROOT-8096/CMakeLists.txt @@ -20,7 +20,7 @@ add_test(NAME roottest-cling-dict-ROOT-8096-build -- ${always-make}) # --target ${targetname_libgen}${fast}) set_property(TEST roottest-cling-dict-ROOT-8096-build PROPERTY ENVIRONMENT ${ROOTTEST_ENVIRONMENT}) -if(CMAKE_GENERATOR MATCHES Ninja) +if(CMAKE_GENERATOR MATCHES Ninja OR CMAKE_GENERATOR MATCHES "Visual Studio") set_property(TEST roottest-cling-dict-ROOT-8096-build APPEND PROPERTY RESOURCE_LOCK NINJA_BUILD) set_property(TEST roottest-cling-dict-ROOT-8096-build APPEND PROPERTY FIXTURES_REQUIRED NINJA_BUILD_ALL) endif() diff --git a/roottest/cling/stl/dicts/CMakeLists.txt b/roottest/cling/stl/dicts/CMakeLists.txt index c31d0a3ee25b3..162e6111ebcbe 100644 --- a/roottest/cling/stl/dicts/CMakeLists.txt +++ b/roottest/cling/stl/dicts/CMakeLists.txt @@ -11,7 +11,7 @@ ROOTTEST_LINKER_LIBRARY(stldictTest TEST MyClass1.cpp MyClass2.cpp MyClass3.cpp # of targets. Doing so right now would build the dictionaries twice. ROOT_ADD_TEST(roottest-cling-stl-dicts-build COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} ${build_config} --target stldictTest${fast} -- ${always-make}) -if(CMAKE_GENERATOR MATCHES Ninja) +if(CMAKE_GENERATOR MATCHES Ninja OR CMAKE_GENERATOR MATCHES "Visual Studio") set_property(TEST roottest-cling-stl-dicts-build APPEND PROPERTY RESOURCE_LOCK NINJA_BUILD) set_property(TEST roottest-cling-stl-dicts-build APPEND PROPERTY FIXTURES_REQUIRED NINJA_BUILD_ALL) endif() diff --git a/roottest/root/io/rootcint/sigbug/CMakeLists.txt b/roottest/root/io/rootcint/sigbug/CMakeLists.txt index a87613d25dbe6..7277dce32c311 100644 --- a/roottest/root/io/rootcint/sigbug/CMakeLists.txt +++ b/roottest/root/io/rootcint/sigbug/CMakeLists.txt @@ -19,7 +19,7 @@ add_test(NAME ${GENERATE_DICTIONARY_TEST} ${build_config} --target ${dictname}${fast} -- ${always-make}) -if(CMAKE_GENERATOR MATCHES Ninja) +if(CMAKE_GENERATOR MATCHES Ninja OR CMAKE_GENERATOR MATCHES "Visual Studio") set_property(TEST ${GENERATE_DICTIONARY_TEST} APPEND PROPERTY RESOURCE_LOCK NINJA_BUILD) set_property(TEST ${GENERATE_DICTIONARY_TEST} APPEND PROPERTY FIXTURES_REQUIRED NINJA_BUILD_ALL) endif() diff --git a/roottest/root/io/tmpifile/CMakeLists.txt b/roottest/root/io/tmpifile/CMakeLists.txt index 840f475bcba53..fc94946fa7f64 100644 --- a/roottest/root/io/tmpifile/CMakeLists.txt +++ b/roottest/root/io/tmpifile/CMakeLists.txt @@ -13,7 +13,7 @@ ROOTTEST_ADD_TEST(split-fail ROOTTEST_ADD_TEST(libjetevent-build COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} ${build_config} --target JetEvent${fast} -- ${always-make}) -if(CMAKE_GENERATOR MATCHES Ninja) +if(CMAKE_GENERATOR MATCHES Ninja OR CMAKE_GENERATOR MATCHES "Visual Studio") set_property(TEST roottest-root-io-tmpifile-libjetevent-build APPEND PROPERTY RESOURCE_LOCK NINJA_BUILD) set_property(TEST roottest-root-io-tmpifile-libjetevent-build APPEND PROPERTY FIXTURES_REQUIRED NINJA_BUILD_ALL) endif() diff --git a/roottest/root/io/transient/base/CMakeLists.txt b/roottest/root/io/transient/base/CMakeLists.txt index c59bacde1dfa2..5d4b65b5cecea 100644 --- a/roottest/root/io/transient/base/CMakeLists.txt +++ b/roottest/root/io/transient/base/CMakeLists.txt @@ -10,7 +10,7 @@ add_test(NAME roottest-root-io-transient-base-build --target base${fast} -- ${always-make}) set_property(TEST roottest-root-io-transient-base-build PROPERTY FIXTURES_SETUP root-io-transient-base-build) -if(CMAKE_GENERATOR MATCHES Ninja) +if(CMAKE_GENERATOR MATCHES Ninja OR CMAKE_GENERATOR MATCHES "Visual Studio") set_property(TEST roottest-root-io-transient-base-build APPEND PROPERTY RESOURCE_LOCK NINJA_BUILD) set_property(TEST roottest-root-io-transient-base-build APPEND PROPERTY FIXTURES_REQUIRED NINJA_BUILD_ALL) endif() diff --git a/roottest/root/meta/genreflex/ROOT-5768/CMakeLists.txt b/roottest/root/meta/genreflex/ROOT-5768/CMakeLists.txt index 18ffb14556114..0bf392ff26a8d 100644 --- a/roottest/root/meta/genreflex/ROOT-5768/CMakeLists.txt +++ b/roottest/root/meta/genreflex/ROOT-5768/CMakeLists.txt @@ -27,7 +27,7 @@ if(NOT MSVC OR win_broken_tests) ROOTTEST_ADD_TEST(PyCoolLib-build COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} ${build_config} --target PyCoolLib${fast} -- ${always-make} FIXTURES_REQUIRED PyCool-reflex-dict) - if(CMAKE_GENERATOR MATCHES Ninja) + if(CMAKE_GENERATOR MATCHES Ninja OR CMAKE_GENERATOR MATCHES "Visual Studio") set_property(TEST roottest-root-meta-genreflex-ROOT-5768-PyCoolLib-build APPEND PROPERTY RESOURCE_LOCK NINJA_BUILD) set_property(TEST roottest-root-meta-genreflex-ROOT-5768-PyCoolLib-build APPEND PROPERTY FIXTURES_REQUIRED NINJA_BUILD_ALL) endif() From b44b075dce6fa8102fbe71242cdf1efafe48f5c0 Mon Sep 17 00:00:00 2001 From: Philippe Canal Date: Mon, 23 Feb 2026 10:53:04 -0600 Subject: [PATCH 2/5] cmake: Use single variable to select Ninja Build resource lock --- cmake/modules/RootCTest.cmake | 2 +- cmake/modules/RootMacros.cmake | 10 +++++++--- roottest/cling/dict/ROOT-8096/CMakeLists.txt | 2 +- roottest/cling/stl/dicts/CMakeLists.txt | 2 +- roottest/root/io/rootcint/sigbug/CMakeLists.txt | 2 +- roottest/root/io/tmpifile/CMakeLists.txt | 2 +- roottest/root/io/transient/base/CMakeLists.txt | 2 +- roottest/root/meta/genreflex/ROOT-5768/CMakeLists.txt | 2 +- 8 files changed, 14 insertions(+), 10 deletions(-) diff --git a/cmake/modules/RootCTest.cmake b/cmake/modules/RootCTest.cmake index 93c55f3c4cedd..6f7d9150e495c 100644 --- a/cmake/modules/RootCTest.cmake +++ b/cmake/modules/RootCTest.cmake @@ -58,7 +58,7 @@ endforeach() # - Add a test that updates the build tree (equivalent to "ninja all"). This one will run in complete isolation. # - Make all tests that require a ninja build depend on the above test. # - Use a RESOURCE_LOCK on all tests that invoke ninja, so no two tests will invoke ninja in parallel -if(CMAKE_GENERATOR MATCHES Ninja OR CMAKE_GENERATOR MATCHES "Visual Studio") +if(GeneratorNeedsBuildSerialization) if (${build_configuration}) set(cmake_build_all_select_config --config ${build_configuration}) endif() diff --git a/cmake/modules/RootMacros.cmake b/cmake/modules/RootMacros.cmake index 82bc39e1b0523..fa6b784acdb77 100644 --- a/cmake/modules/RootMacros.cmake +++ b/cmake/modules/RootMacros.cmake @@ -34,6 +34,10 @@ else() set(runtimedir ${CMAKE_INSTALL_PYTHONDIR}) endif() +if(CMAKE_GENERATOR MATCHES Ninja OR CMAKE_GENERATOR MATCHES "Visual Studio") + set(GeneratorNeedsBuildSerialization True) +endif() + set(ROOT_LIBRARY_PROPERTIES_NO_VERSION ${ROOT_LIBRARY_PROPERTIES_NO_VERSION} SUFFIX ${libsuffix} PREFIX ${libprefix} ) @@ -2641,7 +2645,7 @@ macro(ROOTTEST_GENERATE_DICTIONARY dictname) -- ${always-make}) set_property(TEST ${GENERATE_DICTIONARY_TEST} PROPERTY ENVIRONMENT ${ROOTTEST_ENVIRONMENT}) - if(CMAKE_GENERATOR MATCHES Ninja OR CMAKE_GENERATOR MATCHES "Visual Studio") + if(GeneratorNeedsBuildSerialization) set_property(TEST ${GENERATE_DICTIONARY_TEST} APPEND PROPERTY RESOURCE_LOCK NINJA_BUILD) set_property(TEST ${GENERATE_DICTIONARY_TEST} APPEND PROPERTY FIXTURES_REQUIRED NINJA_BUILD_ALL) endif() @@ -2749,7 +2753,7 @@ macro(ROOTTEST_GENERATE_REFLEX_DICTIONARY dictionary) -- ${always-make}) set_property(TEST ${GENERATE_REFLEX_TEST} PROPERTY ENVIRONMENT ${ROOTTEST_ENVIRONMENT}) - if(CMAKE_GENERATOR MATCHES Ninja OR CMAKE_GENERATOR MATCHES "Visual Studio") + if(GeneratorNeedsBuildSerialization) set_property(TEST ${GENERATE_REFLEX_TEST} APPEND PROPERTY RESOURCE_LOCK NINJA_BUILD) set_property(TEST ${GENERATE_REFLEX_TEST} APPEND PROPERTY FIXTURES_REQUIRED NINJA_BUILD_ALL) endif() @@ -2861,7 +2865,7 @@ macro(ROOTTEST_GENERATE_EXECUTABLE executable) RESOURCE_LOCK ${ARG_RESOURCE_LOCK}) endif() - if(CMAKE_GENERATOR MATCHES Ninja OR CMAKE_GENERATOR MATCHES "Visual Studio") + if(GeneratorNeedsBuildSerialization) set_property(TEST ${GENERATE_EXECUTABLE_TEST} APPEND PROPERTY RESOURCE_LOCK NINJA_BUILD) set_property(TEST ${GENERATE_EXECUTABLE_TEST} APPEND PROPERTY FIXTURES_REQUIRED NINJA_BUILD_ALL) endif() diff --git a/roottest/cling/dict/ROOT-8096/CMakeLists.txt b/roottest/cling/dict/ROOT-8096/CMakeLists.txt index b88a0b9ff1a66..4614dba98fa9b 100644 --- a/roottest/cling/dict/ROOT-8096/CMakeLists.txt +++ b/roottest/cling/dict/ROOT-8096/CMakeLists.txt @@ -20,7 +20,7 @@ add_test(NAME roottest-cling-dict-ROOT-8096-build -- ${always-make}) # --target ${targetname_libgen}${fast}) set_property(TEST roottest-cling-dict-ROOT-8096-build PROPERTY ENVIRONMENT ${ROOTTEST_ENVIRONMENT}) -if(CMAKE_GENERATOR MATCHES Ninja OR CMAKE_GENERATOR MATCHES "Visual Studio") +if(GeneratorNeedsBuildSerialization) set_property(TEST roottest-cling-dict-ROOT-8096-build APPEND PROPERTY RESOURCE_LOCK NINJA_BUILD) set_property(TEST roottest-cling-dict-ROOT-8096-build APPEND PROPERTY FIXTURES_REQUIRED NINJA_BUILD_ALL) endif() diff --git a/roottest/cling/stl/dicts/CMakeLists.txt b/roottest/cling/stl/dicts/CMakeLists.txt index 162e6111ebcbe..874281c54f2cb 100644 --- a/roottest/cling/stl/dicts/CMakeLists.txt +++ b/roottest/cling/stl/dicts/CMakeLists.txt @@ -11,7 +11,7 @@ ROOTTEST_LINKER_LIBRARY(stldictTest TEST MyClass1.cpp MyClass2.cpp MyClass3.cpp # of targets. Doing so right now would build the dictionaries twice. ROOT_ADD_TEST(roottest-cling-stl-dicts-build COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} ${build_config} --target stldictTest${fast} -- ${always-make}) -if(CMAKE_GENERATOR MATCHES Ninja OR CMAKE_GENERATOR MATCHES "Visual Studio") +if(GeneratorNeedsBuildSerialization) set_property(TEST roottest-cling-stl-dicts-build APPEND PROPERTY RESOURCE_LOCK NINJA_BUILD) set_property(TEST roottest-cling-stl-dicts-build APPEND PROPERTY FIXTURES_REQUIRED NINJA_BUILD_ALL) endif() diff --git a/roottest/root/io/rootcint/sigbug/CMakeLists.txt b/roottest/root/io/rootcint/sigbug/CMakeLists.txt index 7277dce32c311..90bdad91bd6e6 100644 --- a/roottest/root/io/rootcint/sigbug/CMakeLists.txt +++ b/roottest/root/io/rootcint/sigbug/CMakeLists.txt @@ -19,7 +19,7 @@ add_test(NAME ${GENERATE_DICTIONARY_TEST} ${build_config} --target ${dictname}${fast} -- ${always-make}) -if(CMAKE_GENERATOR MATCHES Ninja OR CMAKE_GENERATOR MATCHES "Visual Studio") +if(GeneratorNeedsBuildSerialization) set_property(TEST ${GENERATE_DICTIONARY_TEST} APPEND PROPERTY RESOURCE_LOCK NINJA_BUILD) set_property(TEST ${GENERATE_DICTIONARY_TEST} APPEND PROPERTY FIXTURES_REQUIRED NINJA_BUILD_ALL) endif() diff --git a/roottest/root/io/tmpifile/CMakeLists.txt b/roottest/root/io/tmpifile/CMakeLists.txt index fc94946fa7f64..01598393fc184 100644 --- a/roottest/root/io/tmpifile/CMakeLists.txt +++ b/roottest/root/io/tmpifile/CMakeLists.txt @@ -13,7 +13,7 @@ ROOTTEST_ADD_TEST(split-fail ROOTTEST_ADD_TEST(libjetevent-build COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} ${build_config} --target JetEvent${fast} -- ${always-make}) -if(CMAKE_GENERATOR MATCHES Ninja OR CMAKE_GENERATOR MATCHES "Visual Studio") +if(GeneratorNeedsBuildSerialization) set_property(TEST roottest-root-io-tmpifile-libjetevent-build APPEND PROPERTY RESOURCE_LOCK NINJA_BUILD) set_property(TEST roottest-root-io-tmpifile-libjetevent-build APPEND PROPERTY FIXTURES_REQUIRED NINJA_BUILD_ALL) endif() diff --git a/roottest/root/io/transient/base/CMakeLists.txt b/roottest/root/io/transient/base/CMakeLists.txt index 5d4b65b5cecea..9b80c6833a991 100644 --- a/roottest/root/io/transient/base/CMakeLists.txt +++ b/roottest/root/io/transient/base/CMakeLists.txt @@ -10,7 +10,7 @@ add_test(NAME roottest-root-io-transient-base-build --target base${fast} -- ${always-make}) set_property(TEST roottest-root-io-transient-base-build PROPERTY FIXTURES_SETUP root-io-transient-base-build) -if(CMAKE_GENERATOR MATCHES Ninja OR CMAKE_GENERATOR MATCHES "Visual Studio") +if(GeneratorNeedsBuildSerialization) set_property(TEST roottest-root-io-transient-base-build APPEND PROPERTY RESOURCE_LOCK NINJA_BUILD) set_property(TEST roottest-root-io-transient-base-build APPEND PROPERTY FIXTURES_REQUIRED NINJA_BUILD_ALL) endif() diff --git a/roottest/root/meta/genreflex/ROOT-5768/CMakeLists.txt b/roottest/root/meta/genreflex/ROOT-5768/CMakeLists.txt index 0bf392ff26a8d..d28459ed56103 100644 --- a/roottest/root/meta/genreflex/ROOT-5768/CMakeLists.txt +++ b/roottest/root/meta/genreflex/ROOT-5768/CMakeLists.txt @@ -27,7 +27,7 @@ if(NOT MSVC OR win_broken_tests) ROOTTEST_ADD_TEST(PyCoolLib-build COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} ${build_config} --target PyCoolLib${fast} -- ${always-make} FIXTURES_REQUIRED PyCool-reflex-dict) - if(CMAKE_GENERATOR MATCHES Ninja OR CMAKE_GENERATOR MATCHES "Visual Studio") + if(GeneratorNeedsBuildSerialization) set_property(TEST roottest-root-meta-genreflex-ROOT-5768-PyCoolLib-build APPEND PROPERTY RESOURCE_LOCK NINJA_BUILD) set_property(TEST roottest-root-meta-genreflex-ROOT-5768-PyCoolLib-build APPEND PROPERTY FIXTURES_REQUIRED NINJA_BUILD_ALL) endif() From 222ccc39b914f4ee469267887968a943eaef45ac Mon Sep 17 00:00:00 2001 From: Philippe Canal Date: Mon, 23 Feb 2026 10:56:59 -0600 Subject: [PATCH 3/5] cmake: Rename Ninja Build resource lock to CMake Build. It is need by at least Ninja and the Visual Studio generator --- cmake/modules/RootCTest.cmake | 8 ++++---- cmake/modules/RootMacros.cmake | 12 ++++++------ roottest/cling/dict/ROOT-8096/CMakeLists.txt | 4 ++-- roottest/cling/stl/dicts/CMakeLists.txt | 4 ++-- roottest/root/io/rootcint/sigbug/CMakeLists.txt | 4 ++-- roottest/root/io/tmpifile/CMakeLists.txt | 4 ++-- roottest/root/io/transient/base/CMakeLists.txt | 4 ++-- .../root/meta/genreflex/ROOT-5768/CMakeLists.txt | 4 ++-- 8 files changed, 22 insertions(+), 22 deletions(-) diff --git a/cmake/modules/RootCTest.cmake b/cmake/modules/RootCTest.cmake index 6f7d9150e495c..e379d2ed65823 100644 --- a/cmake/modules/RootCTest.cmake +++ b/cmake/modules/RootCTest.cmake @@ -62,10 +62,10 @@ if(GeneratorNeedsBuildSerialization) if (${build_configuration}) set(cmake_build_all_select_config --config ${build_configuration}) endif() - add_test(NAME ninja-build-all + add_test(NAME cmake-build-all COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} ${cmake_build_all_select_config}) - set_tests_properties(ninja-build-all PROPERTIES - RESOURCE_LOCK NINJA_BUILD - FIXTURES_SETUP NINJA_BUILD_ALL + set_tests_properties(cmake-build-all PROPERTIES + RESOURCE_LOCK CMAKE_BUILD + FIXTURES_SETUP CMAKE_BUILD_ALL RUN_SERIAL True) endif() diff --git a/cmake/modules/RootMacros.cmake b/cmake/modules/RootMacros.cmake index fa6b784acdb77..61934ffc17f19 100644 --- a/cmake/modules/RootMacros.cmake +++ b/cmake/modules/RootMacros.cmake @@ -2646,8 +2646,8 @@ macro(ROOTTEST_GENERATE_DICTIONARY dictname) set_property(TEST ${GENERATE_DICTIONARY_TEST} PROPERTY ENVIRONMENT ${ROOTTEST_ENVIRONMENT}) if(GeneratorNeedsBuildSerialization) - set_property(TEST ${GENERATE_DICTIONARY_TEST} APPEND PROPERTY RESOURCE_LOCK NINJA_BUILD) - set_property(TEST ${GENERATE_DICTIONARY_TEST} APPEND PROPERTY FIXTURES_REQUIRED NINJA_BUILD_ALL) + set_property(TEST ${GENERATE_DICTIONARY_TEST} APPEND PROPERTY RESOURCE_LOCK CMAKE_BUILD) + set_property(TEST ${GENERATE_DICTIONARY_TEST} APPEND PROPERTY FIXTURES_REQUIRED CMAKE_BUILD_ALL) endif() if (ARG_FIXTURES_SETUP) @@ -2754,8 +2754,8 @@ macro(ROOTTEST_GENERATE_REFLEX_DICTIONARY dictionary) set_property(TEST ${GENERATE_REFLEX_TEST} PROPERTY ENVIRONMENT ${ROOTTEST_ENVIRONMENT}) if(GeneratorNeedsBuildSerialization) - set_property(TEST ${GENERATE_REFLEX_TEST} APPEND PROPERTY RESOURCE_LOCK NINJA_BUILD) - set_property(TEST ${GENERATE_REFLEX_TEST} APPEND PROPERTY FIXTURES_REQUIRED NINJA_BUILD_ALL) + set_property(TEST ${GENERATE_REFLEX_TEST} APPEND PROPERTY RESOURCE_LOCK CMAKE_BUILD) + set_property(TEST ${GENERATE_REFLEX_TEST} APPEND PROPERTY FIXTURES_REQUIRED CMAKE_BUILD_ALL) endif() if (ARG_FIXTURES_SETUP) @@ -2866,8 +2866,8 @@ macro(ROOTTEST_GENERATE_EXECUTABLE executable) endif() if(GeneratorNeedsBuildSerialization) - set_property(TEST ${GENERATE_EXECUTABLE_TEST} APPEND PROPERTY RESOURCE_LOCK NINJA_BUILD) - set_property(TEST ${GENERATE_EXECUTABLE_TEST} APPEND PROPERTY FIXTURES_REQUIRED NINJA_BUILD_ALL) + set_property(TEST ${GENERATE_EXECUTABLE_TEST} APPEND PROPERTY RESOURCE_LOCK CMAKE_BUILD) + set_property(TEST ${GENERATE_EXECUTABLE_TEST} APPEND PROPERTY FIXTURES_REQUIRED CMAKE_BUILD_ALL) endif() if(MSVC AND NOT CMAKE_GENERATOR MATCHES Ninja) diff --git a/roottest/cling/dict/ROOT-8096/CMakeLists.txt b/roottest/cling/dict/ROOT-8096/CMakeLists.txt index 4614dba98fa9b..e86dfb94915d3 100644 --- a/roottest/cling/dict/ROOT-8096/CMakeLists.txt +++ b/roottest/cling/dict/ROOT-8096/CMakeLists.txt @@ -21,8 +21,8 @@ add_test(NAME roottest-cling-dict-ROOT-8096-build # --target ${targetname_libgen}${fast}) set_property(TEST roottest-cling-dict-ROOT-8096-build PROPERTY ENVIRONMENT ${ROOTTEST_ENVIRONMENT}) if(GeneratorNeedsBuildSerialization) - set_property(TEST roottest-cling-dict-ROOT-8096-build APPEND PROPERTY RESOURCE_LOCK NINJA_BUILD) - set_property(TEST roottest-cling-dict-ROOT-8096-build APPEND PROPERTY FIXTURES_REQUIRED NINJA_BUILD_ALL) + set_property(TEST roottest-cling-dict-ROOT-8096-build APPEND PROPERTY RESOURCE_LOCK CMAKE_BUILD) + set_property(TEST roottest-cling-dict-ROOT-8096-build APPEND PROPERTY FIXTURES_REQUIRED CMAKE_BUILD_ALL) endif() if(MSVC AND NOT CMAKE_GENERATOR MATCHES Ninja) diff --git a/roottest/cling/stl/dicts/CMakeLists.txt b/roottest/cling/stl/dicts/CMakeLists.txt index 874281c54f2cb..58eb53d5d9839 100644 --- a/roottest/cling/stl/dicts/CMakeLists.txt +++ b/roottest/cling/stl/dicts/CMakeLists.txt @@ -12,6 +12,6 @@ ROOTTEST_LINKER_LIBRARY(stldictTest TEST MyClass1.cpp MyClass2.cpp MyClass3.cpp ROOT_ADD_TEST(roottest-cling-stl-dicts-build COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} ${build_config} --target stldictTest${fast} -- ${always-make}) if(GeneratorNeedsBuildSerialization) - set_property(TEST roottest-cling-stl-dicts-build APPEND PROPERTY RESOURCE_LOCK NINJA_BUILD) - set_property(TEST roottest-cling-stl-dicts-build APPEND PROPERTY FIXTURES_REQUIRED NINJA_BUILD_ALL) + set_property(TEST roottest-cling-stl-dicts-build APPEND PROPERTY RESOURCE_LOCK CMAKE_BUILD) + set_property(TEST roottest-cling-stl-dicts-build APPEND PROPERTY FIXTURES_REQUIRED CMAKE_BUILD_ALL) endif() diff --git a/roottest/root/io/rootcint/sigbug/CMakeLists.txt b/roottest/root/io/rootcint/sigbug/CMakeLists.txt index 90bdad91bd6e6..29643d57e2638 100644 --- a/roottest/root/io/rootcint/sigbug/CMakeLists.txt +++ b/roottest/root/io/rootcint/sigbug/CMakeLists.txt @@ -20,6 +20,6 @@ add_test(NAME ${GENERATE_DICTIONARY_TEST} --target ${dictname}${fast} -- ${always-make}) if(GeneratorNeedsBuildSerialization) - set_property(TEST ${GENERATE_DICTIONARY_TEST} APPEND PROPERTY RESOURCE_LOCK NINJA_BUILD) - set_property(TEST ${GENERATE_DICTIONARY_TEST} APPEND PROPERTY FIXTURES_REQUIRED NINJA_BUILD_ALL) + set_property(TEST ${GENERATE_DICTIONARY_TEST} APPEND PROPERTY RESOURCE_LOCK CMAKE_BUILD) + set_property(TEST ${GENERATE_DICTIONARY_TEST} APPEND PROPERTY FIXTURES_REQUIRED CMAKE_BUILD_ALL) endif() diff --git a/roottest/root/io/tmpifile/CMakeLists.txt b/roottest/root/io/tmpifile/CMakeLists.txt index 01598393fc184..d8ce592226b0a 100644 --- a/roottest/root/io/tmpifile/CMakeLists.txt +++ b/roottest/root/io/tmpifile/CMakeLists.txt @@ -14,8 +14,8 @@ ROOTTEST_ADD_TEST(split-fail ROOTTEST_ADD_TEST(libjetevent-build COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} ${build_config} --target JetEvent${fast} -- ${always-make}) if(GeneratorNeedsBuildSerialization) - set_property(TEST roottest-root-io-tmpifile-libjetevent-build APPEND PROPERTY RESOURCE_LOCK NINJA_BUILD) - set_property(TEST roottest-root-io-tmpifile-libjetevent-build APPEND PROPERTY FIXTURES_REQUIRED NINJA_BUILD_ALL) + set_property(TEST roottest-root-io-tmpifile-libjetevent-build APPEND PROPERTY RESOURCE_LOCK CMAKE_BUILD) + set_property(TEST roottest-root-io-tmpifile-libjetevent-build APPEND PROPERTY FIXTURES_REQUIRED CMAKE_BUILD_ALL) endif() ROOTTEST_ADD_TEST(sync-rate diff --git a/roottest/root/io/transient/base/CMakeLists.txt b/roottest/root/io/transient/base/CMakeLists.txt index 9b80c6833a991..820907cd30af4 100644 --- a/roottest/root/io/transient/base/CMakeLists.txt +++ b/roottest/root/io/transient/base/CMakeLists.txt @@ -11,8 +11,8 @@ add_test(NAME roottest-root-io-transient-base-build -- ${always-make}) set_property(TEST roottest-root-io-transient-base-build PROPERTY FIXTURES_SETUP root-io-transient-base-build) if(GeneratorNeedsBuildSerialization) - set_property(TEST roottest-root-io-transient-base-build APPEND PROPERTY RESOURCE_LOCK NINJA_BUILD) - set_property(TEST roottest-root-io-transient-base-build APPEND PROPERTY FIXTURES_REQUIRED NINJA_BUILD_ALL) + set_property(TEST roottest-root-io-transient-base-build APPEND PROPERTY RESOURCE_LOCK CMAKE_BUILD) + set_property(TEST roottest-root-io-transient-base-build APPEND PROPERTY FIXTURES_REQUIRED CMAKE_BUILD_ALL) endif() ROOTTEST_ADD_TEST(WriteFile diff --git a/roottest/root/meta/genreflex/ROOT-5768/CMakeLists.txt b/roottest/root/meta/genreflex/ROOT-5768/CMakeLists.txt index d28459ed56103..26027743a4683 100644 --- a/roottest/root/meta/genreflex/ROOT-5768/CMakeLists.txt +++ b/roottest/root/meta/genreflex/ROOT-5768/CMakeLists.txt @@ -28,7 +28,7 @@ if(NOT MSVC OR win_broken_tests) COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} ${build_config} --target PyCoolLib${fast} -- ${always-make} FIXTURES_REQUIRED PyCool-reflex-dict) if(GeneratorNeedsBuildSerialization) - set_property(TEST roottest-root-meta-genreflex-ROOT-5768-PyCoolLib-build APPEND PROPERTY RESOURCE_LOCK NINJA_BUILD) - set_property(TEST roottest-root-meta-genreflex-ROOT-5768-PyCoolLib-build APPEND PROPERTY FIXTURES_REQUIRED NINJA_BUILD_ALL) + set_property(TEST roottest-root-meta-genreflex-ROOT-5768-PyCoolLib-build APPEND PROPERTY RESOURCE_LOCK CMAKE_BUILD) + set_property(TEST roottest-root-meta-genreflex-ROOT-5768-PyCoolLib-build APPEND PROPERTY FIXTURES_REQUIRED CMAKE_BUILD_ALL) endif() endif() From e830a59eb6d12906c6cb926b130fac1847555157 Mon Sep 17 00:00:00 2001 From: Philippe Canal Date: Mon, 9 Mar 2026 21:53:20 -0500 Subject: [PATCH 4/5] fixup! cmake: Include VStudio in the `Ninja` `RESOURCE_LOCK`. --- cmake/modules/RootMacros.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmake/modules/RootMacros.cmake b/cmake/modules/RootMacros.cmake index 61934ffc17f19..493179c802311 100644 --- a/cmake/modules/RootMacros.cmake +++ b/cmake/modules/RootMacros.cmake @@ -36,6 +36,9 @@ endif() if(CMAKE_GENERATOR MATCHES Ninja OR CMAKE_GENERATOR MATCHES "Visual Studio") set(GeneratorNeedsBuildSerialization True) + if(MSVC) + set(build_config "--config $") + endif() endif() set(ROOT_LIBRARY_PROPERTIES_NO_VERSION ${ROOT_LIBRARY_PROPERTIES_NO_VERSION} From 9fecf21c516f5777ee5567c027f8fe72ccc7163d Mon Sep 17 00:00:00 2001 From: Philippe Canal Date: Mon, 9 Mar 2026 21:54:05 -0500 Subject: [PATCH 5/5] fixup! cmake: Include VStudio in the `Ninja` `RESOURCE_LOCK`. --- cmake/modules/RootCTest.cmake | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/cmake/modules/RootCTest.cmake b/cmake/modules/RootCTest.cmake index e379d2ed65823..54338cd765a18 100644 --- a/cmake/modules/RootCTest.cmake +++ b/cmake/modules/RootCTest.cmake @@ -59,11 +59,8 @@ endforeach() # - Make all tests that require a ninja build depend on the above test. # - Use a RESOURCE_LOCK on all tests that invoke ninja, so no two tests will invoke ninja in parallel if(GeneratorNeedsBuildSerialization) - if (${build_configuration}) - set(cmake_build_all_select_config --config ${build_configuration}) - endif() add_test(NAME cmake-build-all - COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} ${cmake_build_all_select_config}) + COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} ${build_config}) set_tests_properties(cmake-build-all PROPERTIES RESOURCE_LOCK CMAKE_BUILD FIXTURES_SETUP CMAKE_BUILD_ALL