Skip to content

Commit

Permalink
Set HAVE_<PACKAGE_NAME_UC>_<UPSTREAM_PACKAGE_NAME_UC>=OFF for missing…
Browse files Browse the repository at this point in the history
…/undefined packages (TriBITSPub#63)

This is a better solution to the failure reported in trilinos/Trilinos#12291
and applied in the reverted commit:

  05d4429 "Only assert defined vars conditionally"
  Author: Samuel Browne <[email protected]>
  Date:   Thu Sep 28 13:51:05 2023 -0600 (6 days ago)

(which I had suggested at the time).

This new implementation sets
HAVE_<PACKAGE_NAME_UC>_<UPSTREAM_PACKAGE_NAME_UC>=OFF at the project level
right away when the dependencies are being read in and <upstreamPackageName>
is not defined.  This makes for more robust downstream CMake code that works
with optional upstream dependencies when those dependencies are not defined
(like when the package <upstreamPackageName> was removed from the reduced
source tree by the reduced tarball feature).  A downstream package should not
care whether an upstream dependence is disabled or is missing entirely; the
reaction should be the same and it should be able to rely on the same
variables.
  • Loading branch information
bartlettroscoe committed Oct 9, 2023
1 parent 90f098d commit f4bf671
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@

include(TribitsPackageDefineDependencies)
include(TribitsPackageDependencies)
include(TribitsGetHavePackageDependencyMacroName)

include(SetDefault)
include(DualScopeSet)

Expand Down Expand Up @@ -553,11 +555,6 @@ endfunction()
# Implementation macro for tribits_set_dep_packages() to deal with a package
# that is not defined by TriBITS.
#
# ToDo #63: This may need to be modified when dealing with TriBITS-compliant
# packages already installed out on the system. We may need a mode where we
# don't assert packages that are not defined but instead just assume they are
# TriBITS-compliant packages already installed.
#
macro(tribits_set_dep_packages__handle_undefined_pkg packageName depPkg
requiredOrOptional pkgsOrTpls packageEnableVar
)
Expand Down Expand Up @@ -592,6 +589,9 @@ macro(tribits_set_dep_packages__handle_undefined_pkg packageName depPkg
# work.
set(${PROJECT_NAME}_ENABLE_${depPkg} OFF)
set(${packageName}_ENABLE_${depPkg} OFF)
tribits_get_have_package_dependency_macro_name(${packageName} ${depPkg}
havePackageDepPkgMacroName)
set(${havePackageDepPkgMacroName} OFF)
endif()
endmacro()

Expand Down

0 comments on commit f4bf671

Please sign in to comment.