-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for exporting package info vars into <Package>Config.cmake files (#516) #520
Add support for exporting package info vars into <Package>Config.cmake files (#516) #520
Conversation
ad80b55
to
45c038f
Compare
That code just clutters up the main macros() and makes them hard to reason about and maintain.
…#516) This started failing for some reason and I have no idea why. This refactored command is better anyway.
This updates some existing tests for the export of selected package cache vars, including vars from parent package in subpackage <Package>Config.cmake files.
…iBITSPub#516) This provides a mechanism for packages to provide information about how they were configured to downstream CMake projects. Any cache vars set with tribits_add_option_and_define() are exported automatically but TriBITS packages can call tribits_pkg_export_cache_var(<cacheVarName>) to export any cache vars. See updated documentation for details.
45c038f
to
ea526c9
Compare
Hello @KyleFromKitware, can you do a quick review? If not, I can merge and we can set this up for a post-merge review when you have the time. |
tribits/examples/TribitsExampleProject/packages/with_subpackages/a/tests/CMakeLists.txt
Outdated
Show resolved
Hide resolved
tribits/examples/TribitsExampleProject/packages/with_subpackages/a/A.hpp
Outdated
Show resolved
Hide resolved
These were pointed out by @KyleFromKitware in the review of PR TriBITSPub#520.
…b#516) I saw this while working on TriBITSPub#516.
Added macro tribits_assert_cache_and_local_vars_same_value(<cacheVarName>) (with strong unit tests) to ensure that if any exported cache vars also has local vars of the same name that they also have the same value. This was done in response to review of PR TriBITSPub#520 from @KyleFromKitware.
So asserting these exported cache vars has exposed one error in Trilinos CMakeLists.txt files that will need to be fixed in the Pliris package. Details are shown below Testing against Trilinos and identification of defect with Pliris_ENABLE_DREAL: (click to expand)NOTE: I tested this with the Trilinos clang-10.0.0 PR build for Trilinos 'develop' version:
I ran:
This showed the errors:
And reconfiguring with:
showed the same errors. A search of that package shows:
and you can see the error on line 43 :-( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@KyleFromKitware signed off on the fix in #520 (comment).
…g, refactor (TriBITSPub#516) In PR TriBITSPub#520, I accidentally put a requirement that the macro var name had to be set. Turns out, there is special logic for it to not be set. The documentation nor any TriBITS test hinted to this. But the file muelu/CMakeLists.txt actually calls tribits_add_option_and_define() with an empty macro var name. To catch this use case, I added unit tests (which will fail if you undo this patch). In order for the unit tests to cover what is needed, I had to factor out the function tribits_pkg_export_cache_var() into its own module TribitsPkgExportCacheVars.cmake so it could be included in the unit test driver. Then, I decided it would be a good idea to factor out a function tribits_pkg_append_set_commands_for_exported_vars() that is called in the module TribitsWriteClientExportFiles.cmake. Lastly, I moved the function tribits_assert_cache_and_local_vars_same_value() into this module as well. This encapsulates all of the logic to export of these package cache vars into a single module (with just a few dependencies).
Addresses #516
This provides a mechanism for packages to provide information about how they were configured to downstream CMake projects.
Any cache vars set with
tribits_add_option_and_define()
are exported automatically but TriBITS packages can calltribits_pkg_export_cache_var(<cacheVarName>)
to export any cache vars.See updated documentation for details.