Open bartlettroscoe opened 1 year ago
One way to address this is to change tribits_assert_cache_and_local_vars_same_value()
to tribits_assert_dual_scope_local_vars_same_value()
. That will catch if the current scope has the same value as the parent scope. But is that possible? You can set the value of a variable in the direct parent scope, but can you read the value of a variable in a direct parent scope?
For now, I will just comment out that check and see if that fixes the problem for now.
Longer term, I will need find a way to assert this. I think that can be done by setting up a data-structure that remembers what enable vars are exported and then checks them once we get back to the base-level project scope.
I am going to put this back into the backlog for now. Adding this check will be important for catching mistakes in the future when we start to build and install more TriBITS packages independently.
Description
When I implemented the logic to export package enable vars in
<Package>Config.cmake
files in #516, I put in the functiontribits_assert_cache_and_local_vars_same_value(<varName>)
which checks that the cache var is the same value as the local var. But that is not the correct logic because it is fine to hide the cache enable var with a project-level local var which the enable/disable logic does in TriBITS.As a result, we are getting configure errors with Trilinos like:
Proposed solution
The correct solution is to check that the local var value is the same as the project-level local var value. But the problem is that it is not clear how to do that from another scope (like multiple
add_directory()
andfunction()
calls deep).How to check this?