diff --git a/.github/workflows/root-ci-config/build_root.py b/.github/workflows/root-ci-config/build_root.py index 91e50979b86be..8497261d3d443 100755 --- a/.github/workflows/root-ci-config/build_root.py +++ b/.github/workflows/root-ci-config/build_root.py @@ -419,26 +419,13 @@ def cmake_configure(options, buildtype): options = f"{options} -DROOT_COMPILEDATA_IGNORE_BUILD_NODE_CHANGES=ON" result = subprocess_with_log(f""" - cmake -S '{srcdir}' -B '{builddir}' -DCMAKE_BUILD_TYPE={buildtype} {options} + cmake --fresh -S '{srcdir}' -B '{builddir}' -DCMAKE_BUILD_TYPE={buildtype} {options} """) if result != 0: die(result, "Failed cmake generation step") -@github_log_group("Dump existing configuration") -def cmake_dump_config(): - # Print CMake cached config - srcdir = os.path.join(WORKDIR, "src") - builddir = os.path.join(WORKDIR, "build") - result = subprocess_with_log(f""" - cmake -S '{srcdir}' -B '{builddir}' -N -L - """) - - if result != 0: - die(result, "Failed cmake cache print step") - - @github_log_group("Dump requested build configuration") def dump_requested_config(options): print(f"\nBUILD OPTIONS: {options}") @@ -466,10 +453,7 @@ def build(options, buildtype): if result != 0: die(result, "Failed to create build directory") - if not os.path.exists(os.path.join(WORKDIR, "build", "CMakeCache.txt")): - cmake_configure(options, buildtype) - else: - cmake_dump_config() + cmake_configure(options, buildtype) dump_requested_config(options) diff --git a/CMakeLists.txt b/CMakeLists.txt index feb1dcaad6d3b..2ab3fdce03664 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -467,6 +467,15 @@ if(MSVC) endif() if(runtime_cxxmodules) + if(NOT ROOT_CONFIGURED_FROM_CACHE) + # When using cmake --fresh (or changing the toolchain), remove possibly stale pcms that are not tracked by CMake + set(ROOT_CONFIGURED_FROM_CACHE True CACHE BOOL "Shows if ROOT is configured from an existing CMake cache") + mark_as_advanced(ROOT_CONFIGURED_FROM_CACHE) + file(GLOB_RECURSE left_over_pcms ${CMAKE_BINARY_DIR}/*.pcm) + if(left_over_pcms) + file(REMOVE ${left_over_pcms}) + endif() + endif() # Dummy target that does nothing, we don't need a PCH for modules. # Onepcm target has all dependencies needed for allDict.cxx.pch, which allow # to test hsimple.C after all C++ modules are updated.