Skip to content

Commit

Permalink
Amesos: Remove tribtits_add_option_and_define() calls for vars TriBIT…
Browse files Browse the repository at this point in the history
…S automatically sets (trilinos#10355, trilinos#11583)

The updated funtion tribits_add_option_and_define(<optionName> <defineName>
...) will error out if a local non-cache var of the same name <defineName>
already exists.  As explained in the TriBITS Users Guide, for all dependencies
listed in the package's Dependencies.cmake file, TriBITS automatically defines
and sets the vars:

* <Package>_ENABLE_<UpstreamDepPkg>: Cache var and/or non-cache local project-level var

* HAVE_<PACKAGE>_<UPSTREAMDEPPKG>: Non-cache local project-level var

The function tribits_add_option_and_define(<optionName> <defineName> ...)
creates an INTERNAL cache var with the name <defineName>.  (This was done
because some Trilinos packages communicated info through these <defineName>
vars for some reason.)

With new behavior in CMake 3.21+ with policy CMP0126, setting the INTERNAL
cache var <defineName> no longer resets the local var of the same name.
Therefore, the function tribits_add_option_and_define(<optionName>
<defineName> ...) has no impact and does not change anything that impacts
behavior.  Also, since TriBITS automatically defines documented cache vars
with the name <Package>_ENABLE_<UpstreamDepPkg>, the statement
set(<optionName> <value> CACHE BOOL ...) does not have any effect because the
cache var is already set.  Therefore, these calls to:

tribits_add_option_and_define(<Package>_ENABLE_<UpstreamDepPkg>
  HAVE_<PACKAGE>_<UPSTREAMDEPPKG> ...)

have no impact and just confused behavior.  (But were actually masking a nasty
defect described in trilinos#11583 after updating the CMake minimum version to 3.23.)
  • Loading branch information
bartlettroscoe committed Feb 23, 2023
1 parent a93312b commit decfd50
Showing 1 changed file with 0 additions and 10 deletions.
10 changes: 0 additions & 10 deletions packages/amesos/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,6 @@ TRIBITS_ADD_OPTION_AND_DEFINE(${PACKAGE_NAME}_ENABLE_KLU
"Enable KLU (Tim Davis's Files)."
ON )

TRIBITS_ADD_OPTION_AND_DEFINE(${PACKAGE_NAME}_ENABLE_PARDISO
HAVE_AMESOS_PARDISO
"Enable PARDISO functionality."
OFF )

TRIBITS_ADD_OPTION_AND_DEFINE(${PACKAGE_NAME}_ENABLE_PARDISO_MKL
HAVE_AMESOS_PARDISO_MKL
"Enable PARDISO functionality."
OFF )

TRIBITS_ADD_OPTION_AND_DEFINE(${PACKAGE_NAME}_ENABLE_PARAKLETE
HAVE_AMESOS_PARAKLETE
"Enable PARAKLETE functionality."
Expand Down

0 comments on commit decfd50

Please sign in to comment.