Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Moderate assertion-mapping and override-handling issues remain unresolved.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Aligns SeQuant assertion defaults with source-built TiledArray and BTAS, while updating configuration documentation.
Changes:
- Updates assertion defaults and dependency forwarding.
- Preserves explicit dependency overrides.
- Updates installation and contributor guidance.
File summaries
| File | Summary |
|---|---|
doc/user/getting_started/installing.rst |
Documents assertion configuration behavior. |
CMakeLists.txt |
Updates assertion defaults. |
cmake/modules/FindOrFetchTiledArray.cmake |
Adds forwarding; moderate findings remain regarding IGNORE mapping and explicit policy overrides. |
cmake/modules/FindOrFetchBTAS.cmake |
Adds BTAS forwarding; a moderate finding remains regarding IGNORE mapping. |
AGENTS.md |
Updates assertion guidance. |
Review details
Suppressed comments (1)
cmake/modules/FindOrFetchTiledArray.cmake:25
- When a parent project or user explicitly sets
TA_ASSERT_POLICY, this block still derives BTAS fromSEQUANT_ASSERT_BEHAVIOR. For example,TA_ASSERT_POLICY=TA_ASSERT_IGNOREwithSEQUANT_ASSERT_BEHAVIOR=THROWleaves TA assertions disabled but makes BTAS assertions throw, so the documented override and TA/BTAS alignment are broken. Derive this value fromTA_ASSERT_POLICYhere, while retaining the independentBTAS_ASSERT_THROWSoverride guard.
if (SEQUANT_ASSERT_BEHAVIOR STREQUAL THROW)
set(BTAS_ASSERT_THROWS ON CACHE BOOL "Whether BTAS_ASSERT should throw")
else ()
set(BTAS_ASSERT_THROWS OFF CACHE BOOL "Whether BTAS_ASSERT should throw")
- Files reviewed: 5/5 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…rom source
SEQUANT_ASSERT_BEHAVIOR was not forwarded to the dependencies SeQuant builds
from source, so each picked its own default: TiledArray's TA_ASSERT_POLICY
(TA_ASSERT_IGNORE for Release/MinSizeRel, TA_ASSERT_THROW otherwise) and BTAS's
BTAS_ASSERT_THROWS (defaults to BUILD_TESTING, i.e. BTAS_ASSERT throws
regardless of NDEBUG whenever tests are built). The three libraries' assertion
behaviors therefore disagreed: e.g. a Debug build got SeQuant ABORT, TA THROW
and BTAS THROW, and a RelWithDebInfo build got SeQuant IGNORE, TA THROW and
BTAS THROW.
FindOrFetchTiledArray.cmake now sets TA_ASSERT_POLICY to
TA_ASSERT_${SEQUANT_ASSERT_BEHAVIOR} (the values map one-to-one) and
FindOrFetchBTAS.cmake sets BTAS_ASSERT_THROWS ON for THROW and OFF otherwise
(BTAS has no abort mode; with BTAS_ASSERT_THROWS=OFF BTAS_ASSERT is a plain
assert(), the closest match for ABORT). Both are guarded by NOT DEFINED, so a
user -D or a parent project that sets them first keeps control. The BTAS
forwarding is also done in FindOrFetchTiledArray.cmake, since TiledArray, not
FindOrFetchBTAS, is what builds BTAS in a SEQUANT_TILEDARRAY build.
Also align SeQuant's own default with TiledArray's build-type partition:
IGNORE for Release and MinSizeRel, ABORT otherwise (previously ABORT for Debug
only, IGNORE otherwise) -- a RelWithDebInfo build is meant to be debuggable, so
silently dropping asserts there was surprising.
Two review comments on the forwarding added in the previous commit:
1. mapping IGNORE (and ABORT) onto BTAS_ASSERT_THROWS=OFF does not
implement IGNORE. At the BTAS tracked so far, BTAS_ASSERT_THROWS=OFF
makes BTAS_ASSERT a plain assert(), so a Debug build configured with
SEQUANT_ASSERT_BEHAVIOR=IGNORE still aborted on a BTAS assertion.
BTAS has since gained a real 3-mode policy, BTAS_ASSERT_POLICY =
BTAS_ASSERT_{THROW,ABORT,IGNORE} (ValeevGroup/BTAS#188), that is not
affected by NDEBUG; forward that as the primary knob, in both modules.
BTAS_ASSERT_THROWS is kept as the compatibility shim for a BTAS older
than that -- notably the one the tracked TiledArray builds, until its
tag moves past ValeevGroup/tiledarray#587 -- where both ABORT and
IGNORE still degrade to assert() semantics. The modules, AGENTS.md and
installing.rst say so; that is a limitation of the older BTAS, not
alignment.
2. in FindOrFetchTiledArray.cmake the BTAS setting was derived from
SEQUANT_ASSERT_BEHAVIOR, so a user who overrode TA_ASSERT_POLICY (e.g.
TA_ASSERT_IGNORE with SEQUANT_ASSERT_BEHAVIOR=THROW) got a BTAS that
disagreed with TiledArray. Derive it from the effective
TA_ASSERT_POLICY instead, i.e. after the override guard, and derive
the BTAS_ASSERT_THROWS shim from the effective BTAS_ASSERT_POLICY, so
that an explicit BTAS_ASSERT_POLICY is not contradicted by the shim.
The independent BTAS_ASSERT_{POLICY,THROWS} override guards remain.
Brings in BTAS_ASSERT_POLICY (ValeevGroup/BTAS#188), which FindOrFetchBTAS.cmake now forwards SEQUANT_ASSERT_BEHAVIOR to; without it SEQUANT_ASSERT_BEHAVIOR=IGNORE only reaches BTAS as the deprecated BTAS_ASSERT_THROWS=OFF, i.e. as a plain assert() that still aborts unless NDEBUG is defined. N.B. this tag is only used when SeQuant itself builds BTAS, i.e. in a SEQUANT_BTAS build without TiledArray; otherwise TiledArray's own BTAS tag decides.
a43593d to
37617c3
Compare
The forwarded values are cache entries, so on the second configure the NOT DEFINED guard was false and a changed SEQUANT_ASSERT_BEHAVIOR left TiledArray and BTAS at the policies derived from the old value. Record what was derived (SEQUANT_TA_ASSERT_POLICY_DERIVED, SEQUANT_BTAS_ASSERT_POLICY_DERIVED, SEQUANT_BTAS_ASSERT_THROWS_DERIVED, all INTERNAL) and re-derive, with FORCE, whenever the forwarded variable is undefined or still equals what was recorded; a value the user or a parent project set explicitly differs from the record and survives reconfigures. Same pattern as TiledArray's own forwarding (ValeevGroup/tiledarray#587).
…-out
CMake cannot distinguish an explicit -DTA_ASSERT_POLICY=<X> (or
-DBTAS_ASSERT_POLICY=<X>) from a cache entry that already holds <X>, so
matching the value against the one last derived could clobber an explicit
override that happened to equal it.
Now each forwarded knob has an opt-out option, both ON by default:
SEQUANT_TA_ASSERT_POLICY_FOLLOWS_SEQUANT for TA_ASSERT_POLICY, and
SEQUANT_BTAS_ASSERT_POLICY_FOLLOWS_SEQUANT for BTAS_ASSERT_POLICY together
with its deprecated predecessor BTAS_ASSERT_THROWS. While an option is ON
the corresponding value is re-derived with FORCE on every configure; a
value that differs from the one SeQuant last acknowledged
(SEQUANT_TA_ASSERT_POLICY_SEEN, SEQUANT_BTAS_ASSERT_{POLICY,THROWS}_SEEN,
all INTERNAL) is taken as an explicit user value: it is honored and turns
the option OFF with a STATUS message. Turning the option back ON resumes
following.
The SEEN entries are recorded after FetchContent_MakeAvailable of the
subproject, so that on a first configure with following OFF and no
explicit value the subproject's own default is what gets acknowledged, and
turning following back ON later still works.
Same pattern as TiledArray's own forwarding (ValeevGroup/tiledarray#587).
The two options and the -D-vs-cache ambiguity are documented in
installing.rst and AGENTS.md.
Brings in the TiledArray side of the assert-policy forwarding (ValeevGroup/tiledarray#587): TiledArray now pins a BTAS that has BTAS_ASSERT_POLICY (ValeevGroup/BTAS#188) and forwards TA_ASSERT_POLICY to it itself. Without this, the BTAS that TiledArray builds in a SEQUANT_TILEDARRAY build only understands the deprecated BTAS_ASSERT_THROWS, whose OFF is a plain assert() -- neither ABORT nor IGNORE.
With the TiledArray and BTAS tags tracked in external/versions.cmake, both paths that build BTAS give it a real BTAS_ASSERT_POLICY, so the "ABORT and IGNORE degrade to assert() semantics" caveat is only reachable by pointing the build at an older BTAS by hand (an overridden tag or FETCHCONTENT_SOURCE_DIR). Say that in FindOrFetchTiledArray.cmake, installing.rst and AGENTS.md; the BTAS_ASSERT_THROWS shim itself stays, for exactly that case.
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved critical and moderate issues remain in assertion-policy forwarding and override handling.
Get a fresh assessment by requesting another Copilot review.
Review details
Suppressed comments (5)
cmake/modules/FindOrFetchBTAS.cmake:48
- If only the documented deprecated override
BTAS_ASSERT_THROWSis set, this condition turns following off but the message interpolates onlyBTAS_ASSERT_POLICY, which may be empty. Report both variables (or the variable that triggered the override) so the status message explains why following was disabled.
message(STATUS "BTAS's assertion behavior was set explicitly (BTAS_ASSERT_POLICY=${BTAS_ASSERT_POLICY}): SEQUANT_BTAS_ASSERT_POLICY_FOLLOWS_SEQUANT turned OFF, it will no longer follow SeQuant's")
cmake/modules/FindOrFetchTiledArray.cmake:44
- The phrase “one an overridden ... points at” is ungrammatical; rephrase it so the source-selection caveat is clear.
# forwarded as well, for a BTAS older than that (e.g. one an overridden
# TA_TRACKED_BTAS_TAG or FETCHCONTENT_SOURCE_DIR_BTAS points at).
cmake/modules/FindOrFetchTiledArray.cmake:27
FetchContent_MakeAvailable(TiledArray)below is allowed to satisfyFIND_PACKAGE_ARGSfrom an installed TiledArray, but these forwarding assignments run before that choice and are unconditional. In that case no source dependency consumes the values, while theFORCEd TA/BTAS cache entries still alter the parent project and the later..._SEENstate. Restrict the forwarding and acknowledgement to the FetchContent source-build path so installed targets retain their own configured policy.
set(TA_ASSERT_POLICY TA_ASSERT_${SEQUANT_ASSERT_BEHAVIOR} CACHE STRING "Controls the behavior of TA_ASSERT" FORCE)
cmake/modules/FindOrFetchTiledArray.cmake:62
- If only the documented deprecated override
BTAS_ASSERT_THROWSis set, this condition turns following off but the message interpolates onlyBTAS_ASSERT_POLICY, which may be empty. Report both variables (or the variable that triggered the override) so the status message explains why following was disabled.
message(STATUS "BTAS's assertion behavior was set explicitly (BTAS_ASSERT_POLICY=${BTAS_ASSERT_POLICY}): SEQUANT_BTAS_ASSERT_POLICY_FOLLOWS_SEQUANT turned OFF, it will no longer follow SeQuant's")
doc/user/getting_started/installing.rst:116
- The sentence uses
therewhere the definite articletheis required.
N.B. a BTAS older than ``BTAS_ASSERT_POLICY`` (ValeevGroup/BTAS#188) has neither an abort nor an ignore mode -- there
- Files reviewed: 6/6 changed files
- Comments generated: 3
- Review effort level: Lite
…_THROWS shim Both tracked tags are past BTAS_ASSERT_POLICY (ValeevGroup/BTAS#188) and TiledArray's own forwarding of TA_ASSERT_POLICY to BTAS (ValeevGroup/tiledarray#587), so SeQuant no longer needs to derive BTAS's policy itself when TiledArray builds BTAS, nor to set the deprecated boolean. FindOrFetchTiledArray forwards SEQUANT_ASSERT_BEHAVIOR as TA_ASSERT_POLICY only, and only when TiledArray is built from source (probed the way FetchContent's FIND_PACKAGE_ARGS will); FindOrFetchBTAS (used when SeQuant builds BTAS itself) forwards BTAS_ASSERT_POLICY only. Each keeps its SEQUANT_*_ASSERT_POLICY_FOLLOWS_SEQUANT opt-out and _SEEN marker. This retires the cases where the shim and the duplicate derivation disagreed: an undefined TA_ASSERT_POLICY producing BTAS_ASSERT_ (following off on a fresh configure), a changed BTAS_ASSERT_THROWS ignored next to a cached BTAS_ASSERT_POLICY, the shim losing to TiledArray's own forwarding, and forced cache entries when TiledArray comes installed.
|
Re the five suppressed comments of the last Copilot round: the two status-message ones and the shim-vs-policy one are resolved by dropping the BTAS_ASSERT_THROWS shim (32967a6); the two wording nits are gone with the rewritten docs; the installed-TiledArray one is addressed by probing find_package(TiledArray CONFIG QUIET) the way FetchContent's FIND_PACKAGE_ARGS will and skipping the forwarding (and the _SEEN marker) when it succeeds. PR body has the updated verification tables. |
There was a problem hiding this comment.
🔵 Needs a closer look
The TiledArray discovery logic must preserve parent-selected FetchContent sources.
Review details
Suppressed comments (1)
cmake/modules/FindOrFetchTiledArray.cmake:32
- This pre-probe can bypass a parent project's FetchContent declaration. A parent may declare
TiledArraywith a customSOURCE_DIR,GIT_TAG, orFIND_PACKAGE_ARGSwithout settingFETCHCONTENT_SOURCE_DIR_TILEDARRAY; if an installed package is found here,FetchContent_MakeAvailablelater sees the target and never consumes that declaration. Please inspect existing FetchContent properties/declarations before probing, or only probe when this module owns the declaration, so a parent-selected source cannot be silently replaced by an installed TiledArray.
if (NOT DEFINED FETCHCONTENT_SOURCE_DIR_TILEDARRAY AND NOT FETCHCONTENT_TRY_FIND_PACKAGE_MODE STREQUAL NEVER)
find_package(TiledArray CONFIG QUIET COMPONENTS tiledarray)
if (TiledArray_FOUND)
set(_sequant_ta_from_source FALSE)
endif()
- Files reviewed: 6/6 changed files
- Comments generated: 0 new
- Review effort level: Lite
…by probing Probing find_package(TiledArray) before FetchContent_MakeAvailable could hijack a parent project's own TiledArray declaration (an installed package found by the probe satisfies the target and the parent's declared source is never consumed). Forward TA_ASSERT_POLICY unconditionally instead, and after FetchContent_MakeAvailable use tiledarray_SOURCE_DIR (set only when TiledArray was populated from source) to decide: from source, record the acknowledged value; installed, restore TA_ASSERT_POLICY and the SEQUANT_TA_ASSERT_POLICY_FOLLOWS_SEQUANT option to their pre-forwarding state and drop the marker, so the parent's cache is left as it was.
|
Re the suppressed comment on the find_package pre-probe in FindOrFetchTiledArray.cmake: agreed, a probe ahead of FetchContent_MakeAvailable could hijack a parent project's own TiledArray declaration. c303f2d drops the probe and decides afterwards instead: TA_ASSERT_POLICY is forwarded unconditionally, and once FetchContent_MakeAvailable has run, tiledarray_SOURCE_DIR (set only when TiledArray was populated from source) selects between recording the acknowledged value and undoing the forwarding (TA_ASSERT_POLICY and the FOLLOWS option restored to their pre-forwarding cache state, marker dropped) when an installed TiledArray was used. Source-path verification (trees A/B in the description) re-run and unchanged; there is no installed TiledArray on this machine, so the restore branch is verified by reading, not by a configure. |
There was a problem hiding this comment.
🔵 Needs a closer look
Two moderate cache-handling issues remain in the TiledArray integration.
Review details
Suppressed comments (2)
cmake/modules/FindOrFetchTiledArray.cmake:46
- On a build directory configured with the previous SeQuant,
TA_ASSERT_POLICYis already cached by TiledArray, butSEQUANT_TA_ASSERT_POLICY_SEENdoes not exist. The first configure after this change therefore takes this old dependency default as an explicit override and forcesSEQUANT_TA_ASSERT_POLICY_FOLLOWS_SEQUANT=OFF; for example, an existing RelWithDebInfo cache can remainTA_ASSERT_THROWinstead of adopting the new SeQuant defaultTA_ASSERT_ABORT. Please add a migration path, or document a required cache reset/explicit policy, so upgrades do not silently retain the old mismatched default.
if (DEFINED TA_ASSERT_POLICY AND NOT (DEFINED SEQUANT_TA_ASSERT_POLICY_SEEN AND TA_ASSERT_POLICY STREQUAL SEQUANT_TA_ASSERT_POLICY_SEEN))
# explicit user value (on the first configure, or changed since SeQuant last saw it): honor it, stop following
set(SEQUANT_TA_ASSERT_POLICY_FOLLOWS_SEQUANT OFF CACHE BOOL "${_sequant_ta_follow_doc}" FORCE)
message(STATUS "TA_ASSERT_POLICY=${TA_ASSERT_POLICY} was set explicitly: SEQUANT_TA_ASSERT_POLICY_FOLLOWS_SEQUANT turned OFF, TA_ASSERT_POLICY will no longer follow SEQUANT_ASSERT_BEHAVIOR")
cmake/modules/FindOrFetchTiledArray.cmake:88
- When TiledArray is satisfied by an installed package, this branch restores the prior follow option only if it existed. On a fresh installed-package configure,
option()above has already createdSEQUANT_TA_ASSERT_POLICY_FOLLOWS_SEQUANTin the cache, but_sequant_ta_follows_beforeis undefined, so the source-only option is left behind even though it has no effect for the installed target (and can leak into a later source reconfiguration). Unset it in theelsebranch so the installed path leaves the cache unchanged.
if (DEFINED _sequant_ta_follows_before)
set(SEQUANT_TA_ASSERT_POLICY_FOLLOWS_SEQUANT "${_sequant_ta_follows_before}" CACHE BOOL "Derive TA_ASSERT_POLICY from SEQUANT_ASSERT_BEHAVIOR when TiledArray is built from source; OFF leaves TA_ASSERT_POLICY to the user (or to TiledArray's default)" FORCE)
endif()
unset(SEQUANT_TA_ASSERT_POLICY_SEEN CACHE)
- Files reviewed: 6/6 changed files
- Comments generated: 0 new
- Review effort level: Lite
… forwarding
A build directory configured before SeQuant forwarded SEQUANT_ASSERT_BEHAVIOR
has the dependency's own default cached and no acknowledgment marker, so the
first reconfigure treats it as an explicit value and turns following off.
That is the intended conservative behavior (CMake cannot tell the two
apart); the status message now says so and names the one-line fix
(reconfigure with -DSEQUANT_{TA,BTAS}_ASSERT_POLICY_FOLLOWS_SEQUANT=ON),
and installing.rst documents it. Also drop the FOLLOWS option that
option() created when an installed TiledArray ends up being used, so that
path leaves the cache untouched.
|
Re the two suppressed comments of the last round (61a2f6e): (1) upgrade of an existing build directory: the cached pre-forwarding default is indeed taken as an explicit value on the first reconfigure (CMake cannot tell them apart, and keeping the cached value is the conservative choice); the status message now says so and names the fix, a single reconfigure with -DSEQUANT_TA_ASSERT_POLICY_FOLLOWS_SEQUANT=ON (same for BTAS), and installing.rst documents it. Simulated by stripping the marker from a configured cache and setting TA_ASSERT_POLICY=TA_ASSERT_THROW: the reconfigure reports it and turns following OFF (TA stays THROW), and the reconfigure with the option ON adopts TA_ASSERT_ABORT. (2) installed-TiledArray path: the FOLLOWS option that option() created is now unset in that branch, so the cache is left as it was. |
There was a problem hiding this comment.
🔵 Needs a closer look
Address stale-cache handoff issues when switching between direct-BTAS and TiledArray modes.
Review details
Suppressed comments (2)
cmake/modules/FindOrFetchBTAS.cmake:31
- The reverse transition has the same stale-cache failure: after a TiledArray build,
BTAS_ASSERT_POLICYremains cached but this module has noSEQUANT_BTAS_ASSERT_POLICY_SEENmarker because TiledArray recordsTA_BTAS_ASSERT_POLICY_SEEN. Switching toSEQUANT_TILEDARRAY=OFFtherefore classifies TiledArray's derived value as an explicit BTAS override, turns this follows option OFF, and subsequent changes toSEQUANT_ASSERT_BEHAVIORno longer update direct BTAS. Please recognize the TiledArray-derived marker or reset the value when taking ownership here, without clobbering a real user override.
# SEQUANT_BTAS_ASSERT_POLICY_FOLLOWS_SEQUANT is the opt-out: while ON,
# BTAS_ASSERT_POLICY is (re)derived from SEQUANT_ASSERT_BEHAVIOR on every
# configure; an explicit BTAS_ASSERT_POLICY that differs from the value SeQuant
# last acknowledged (recorded in SEQUANT_BTAS_ASSERT_POLICY_SEEN) is honored
# and turns the option OFF. Turning it back ON resumes following.
cmake/modules/FindOrFetchTiledArray.cmake:16
- When an existing build directory is reconfigured from the direct-BTAS mode to
SEQUANT_TILEDARRAY=ON, the previous direct path leavesBTAS_ASSERT_POLICYandSEQUANT_BTAS_ASSERT_POLICY_SEENin the cache. TiledArray uses its separateTA_BTAS_ASSERT_POLICY_SEEN, so it treats that inherited policy as a new explicit override, disablesTA_BTAS_ASSERT_POLICY_FOLLOWS_TA, and a later change toSEQUANT_ASSERT_BEHAVIORcan leave TA and BTAS on different policies. Please hand off or clear SeQuant-derived BTAS state when entering this path, while preserving an actual user override.
# BTAS is not handled here: the tracked TiledArray builds BTAS itself and
# forwards the effective TA_ASSERT_POLICY to it as BTAS_ASSERT_POLICY
# (ValeevGroup/tiledarray#587, with its own TA_BTAS_ASSERT_POLICY_FOLLOWS_TA
# opt-out), so an explicit or forwarded TA_ASSERT_POLICY reaches BTAS too.
- Files reviewed: 6/6 changed files
- Comments generated: 0 new
- Review effort level: Lite
…g modes Reconfiguring a build directory from SEQUANT_TILEDARRAY=ON (TiledArray builds BTAS, marker TA_BTAS_ASSERT_POLICY_SEEN) to OFF (SeQuant builds BTAS, marker SEQUANT_BTAS_ASSERT_POLICY_SEEN) or back left the cached BTAS_ASSERT_POLICY with the other module's marker, so the receiving module took it for a user override and stopped following. Each module now adopts the other's acknowledged value as its own marker when the cached policy equals it (and drops the foreign marker); a real override differs from the marker and is left alone.
|
Re the two suppressed comments on switching SEQUANT_TILEDARRAY in an existing build directory (6a23c0c): each BTAS-building path now adopts the other's acknowledged value as its own marker when the cached BTAS_ASSERT_POLICY equals it, and drops the foreign marker, so following continues across the switch; a real override differs from the marker and is honored as before. Verified configure-only in one tree: TA on (BTAS derived ABORT) -> TA off (adopted, SEQUANT_ASSERT_BEHAVIOR=IGNORE then moves BTAS to IGNORE) -> TA on with THROW (TiledArray adopts, TA and BTAS both THROW; ABORT next) -> TA off with an explicit BTAS_ASSERT_POLICY=BTAS_ASSERT_THROW (honored, following OFF) -> IGNORE (BTAS stays THROW). |
There was a problem hiding this comment.
🟡 Changes recommended
Two moderate issues remain in cross-configuration policy provenance handling.
Get a fresh assessment by requesting another Copilot review.
Review details
- Files reviewed: 6/6 changed files
- Comments generated: 2
- Review effort level: Lite
| # for a user override; a real override differs from the marker and is left | ||
| # alone. | ||
| if (DEFINED TA_BTAS_ASSERT_POLICY_SEEN) | ||
| if (DEFINED BTAS_ASSERT_POLICY AND BTAS_ASSERT_POLICY STREQUAL TA_BTAS_ASSERT_POLICY_SEEN AND NOT DEFINED SEQUANT_BTAS_ASSERT_POLICY_SEEN) |
| # deriving BTAS's policy instead of mistaking it for a user override; a real | ||
| # override differs from the marker and is left alone. | ||
| if (DEFINED SEQUANT_BTAS_ASSERT_POLICY_SEEN) | ||
| if (DEFINED BTAS_ASSERT_POLICY AND BTAS_ASSERT_POLICY STREQUAL SEQUANT_BTAS_ASSERT_POLICY_SEEN AND NOT DEFINED TA_BTAS_ASSERT_POLICY_SEEN) |
Replace the FOLLOWS options, acknowledgment markers, mode-switch handoff and installed-package restore with the plain CMake idiom: if TA_ASSERT_POLICY (BTAS_ASSERT_POLICY when SeQuant builds BTAS itself) is not in the cache yet, seed it from SEQUANT_ASSERT_BEHAVIOR, without FORCE. The first configure of a build directory aligns the dependencies with SeQuant, an explicit -D from the user or a parent project is already in the cache and wins, and a later change of SEQUANT_ASSERT_BEHAVIOR does not re-seed (set the option explicitly, or use a fresh build directory), which is how every cached option behaves and is documented as such. CMake cannot distinguish an explicit -D from a stale cache entry, so the removed machinery could only ever approximate that, and each approximation had a corner case; not fighting the cache is the fix.
|
27ccc22 replaces all of the forwarding machinery (FOLLOWS options, acknowledgment markers, mode-switch handoff, installed-package restore) with the plain cached-option idiom: seed TA_ASSERT_POLICY / BTAS_ASSERT_POLICY from SEQUANT_ASSERT_BEHAVIOR only if not in the cache yet, no FORCE. An explicit -D wins and a later change of SEQUANT_ASSERT_BEHAVIOR does not re-seed, like any cached option; CMake cannot distinguish an explicit -D from a stale cache entry, so the removed machinery could only approximate that, and every approximation had a corner case. Description rewritten accordingly; the same reduction of TiledArray's BTAS forwarding follows in a separate TiledArray PR. |
Problem
SEQUANT_ASSERT_BEHAVIORdid not reach the dependencies SeQuant builds from source, so TiledArray and BTAS picked their own defaults (BTAS: throw wheneverBUILD_TESTING=ON, regardless ofNDEBUG) and the three libraries could disagree on what a tripped assertion does.Change
SEQUANT_ASSERT_BEHAVIORdefaults toABORTexcept forRelease/MinSizeRel(IGNORE), matchingassert()'s spirit and TiledArray's partition.FindOrFetchTiledArray.cmakeseedsTA_ASSERT_POLICYfromSEQUANT_ASSERT_BEHAVIORif it is not in the cache yet (THROW/ABORT/IGNOREmap one-to-one); TiledArray seedsBTAS_ASSERT_POLICYof the BTAS it builds the same way (cmake: forward TA_ASSERT_POLICY to BTAS built from source tiledarray#587, being reduced to the same idiom in a follow-up).FindOrFetchBTAS.cmakeseedsBTAS_ASSERT_POLICYwhen SeQuant builds BTAS itself (SEQUANT_TILEDARRAY=OFF).-DTA_ASSERT_POLICY=.../-DBTAS_ASSERT_POLICY=...(from the user or a parent project) is already in the cache and wins; a later change ofSEQUANT_ASSERT_BEHAVIORdoes not re-seed, exactly as a change ofCMAKE_BUILD_TYPEdoes not re-default it (set the option explicitly, or use a fresh build directory). CMake cannot distinguish an explicit-Dfrom a stale cache entry, so anything smarter can only approximate that and has corner cases; the earlier commits on this branch tried, and 27ccc22 removes all of it.02d03c42c(tiledarray#587:BTAS_ASSERT_POLICYforwarding), BTAS52aadfe54(BTAS_ASSERT_POLICY: real THROW / ABORT / IGNORE modes BTAS#188:BTAS_ASSERT_POLICYwith THROW/ABORT/IGNORE, none NDEBUG-dependent). A BTAS older than that ignoresBTAS_ASSERT_POLICYand only knows the booleanBTAS_ASSERT_THROWS, which SeQuant does not touch.installing.rstandAGENTS.mddescribe the above in one paragraph each.Verification (configure-only, TiledArray
02d03c42c+ BTAS52aadfe54from source, RelWithDebInfo,BUILD_TESTING=ON)-DSEQUANT_ASSERT_BEHAVIORTA_ASSERT_POLICYBTAS_ASSERT_POLICYSEQUANT_ASSERT_BEHAVIOR=IGNORETA_ASSERT_POLICY=TA_ASSERT_THROWSEQUANT_ASSERT_BEHAVIOR=IGNORETA_ASSERT_POLICY=TA_ASSERT_IGNOREBTAS_ASSERT_POLICY=BTAS_ASSERT_IGNORESEQUANT_ASSERT_BEHAVIOR=IGNOREBTAS_ASSERT_POLICY=BTAS_ASSERT_IGNORESEQUANT_ASSERT_BEHAVIOR=THROWNote: in the "TA on" rows BTAS is governed by the pinned TiledArray, whose current forwarding still re-derives; once the TiledArray follow-up lands, BTAS behaves like the
TA_ASSERT_POLICYcolumn (seeded once). No SeQuant-owned marker/option entries remain in any cache.