Skip to content

Commit

Permalink
Revert "Only assert defined vars conditionally"
Browse files Browse the repository at this point in the history
This reverts commit 05d4429.

I am going to implement what I believe is a better, more robust solution in a
later commit (after adding a failing test to cover the case that this commit
addresses).
  • Loading branch information
bartlettroscoe committed Jan 26, 2024
1 parent 9874c37 commit 4628278
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions tribits/core/package_arch/TribitsPackageMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -440,19 +440,13 @@ macro(tribits_disable_optional_dependency upstreamPackageName reasonStr)
" Instead, please call this from the package's base CMakeLists.txt file"
" '${${PACKAGE_NAME}_SOURCE_DIR}/CMakeLists.txt'" )
endif()
# Get the variable names that are going to be set
# Get the variable names that are going to be set assert they exist already
set(packageEnableVarName ${PACKAGE_NAME}_ENABLE_${upstreamPackageName})
assert_defined(${packageEnableVarName})
string(TOUPPER ${upstreamPackageName} upstreamPackageName_UC)
set(havePackageUpstreamPackageMacroVarName
HAVE_${PACKAGE_NAME_UC}_${upstreamPackageName_UC})
# Assert that the vars already exist (to make sure the package and dependency exist)
if (${PROJECT_NAME}_ASSERT_DEFINED_DEPENDENCIES IN_LIST
${PROJECT_NAME}_ASSERT_DEFINED_DEPENDENCIES_ERROR_VALUES_LIST
)
# We only assert if all packages have to exist, which is not true in a reduced source tree
assert_defined(${packageEnableVarName})
assert_defined(${havePackageUpstreamPackageMacroVarName})
endif()
assert_defined(${havePackageUpstreamPackageMacroVarName})
# Set the variables to OFF in local and project-level scopes
if (NOT "${reasonStr}" STREQUAL "")
message("-- ${reasonStr}")
Expand Down

0 comments on commit 4628278

Please sign in to comment.