cmake: don't let a stale cache poison the ROOT7 API compile check.

check_cxx_source_compiles() caches MUSRVIEW_HAS_ROOT7_API under a plain
variable name with no dependency tracking, so a failure recorded once
(e.g. against an older ROOT built into the same build/ directory) kept
being reported as missing on every later reconfigure even after ROOT was
fine. Unset both cache entries before the check so it always re-runs.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
suter_aandClaude Sonnet 5 committed 2026-09-11 16:46:42 +02:00
1 parent ff8fb9cf70
commit 4302b40d9e
1 file changed
+9
+9
View File
@@ -138,6 +138,15 @@ set(CMAKE_REQUIRED_QUIET TRUE)
set(_musrview_try_compile_type_save "${CMAKE_TRY_COMPILE_TARGET_TYPE}")
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
#--- check_cxx_source_compiles() caches its result under a plain variable
#--- name with no dependency tracking: if it once failed (e.g. against an
#--- older ROOT in this same build directory) it would keep reporting that
#--- stale failure on every later reconfigure, even after ROOT got fixed,
#--- since neither the test source nor ROOT_VERSION are part of the cache
#--- key. Unset both results first so the compile check always re-runs. ------
unset(MUSRVIEW_HAS_ROOT7_API CACHE)
unset(MUSRVIEW_HAS_ROOT7_API_EXPERIMENTAL CACHE)
set(MUSRVIEW_NS "ROOT::")
string(CONFIGURE "${MUSRVIEW_ROOT7_API_TEST_SRC}" _musrview_api_src @ONLY)
check_cxx_source_compiles("${_musrview_api_src}" MUSRVIEW_HAS_ROOT7_API)