Skip to content
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

tribits_add_option_and_define(): restore optional macro define var arg, refactor (#516) #521

Merged

Conversation

bartlettroscoe
Copy link
Member

Follow-up from PR #520, addresses #516

See commit log msg for details.

NOTE: This should fix the error reported in trilinos/Trilinos#10925 (@glhenni).

…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).
@bartlettroscoe bartlettroscoe self-assigned this Aug 24, 2022
@bartlettroscoe bartlettroscoe added this to In Progress in TriBITS Refactor via automation Aug 24, 2022
@bartlettroscoe bartlettroscoe moved this from In Progress to In Review in TriBITS Refactor Aug 24, 2022
Copy link
Collaborator

@rabartlett1972 rabartlett1972 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Going to allow merge since this is breaking Charon + Trilinos integration (trilinos/Trilinos#10925).

Then can set up for post-merge review.

@bartlettroscoe bartlettroscoe merged commit 4ab6cae into TriBITSPub:master Aug 24, 2022
TriBITS Refactor automation moved this from In Review to Done Aug 24, 2022
@bartlettroscoe bartlettroscoe moved this from Done to In Review in TriBITS Refactor Aug 24, 2022
@bartlettroscoe
Copy link
Member Author

@KyleFromKitware, can you please do a post-merge review of this PR? I had to rush to merge it because TriBITS 'master' was breaking customer code (see trilinos/Trilinos#10925).

@bartlettroscoe
Copy link
Member Author

bartlettroscoe commented Aug 24, 2022

FYI: Using the same approach as described in #520 (comment), I reverted the patch in this PR and was able to reproduce the Trilinos configure error:

CMake Error at TriBITS/tribits/core/package_arch/TribitsAddOptionAndDefine.cmake:88 (tribits_pkg_export_cache_var):
  tribits_pkg_export_cache_var Macro invoked with incorrect arguments for
  macro named: tribits_pkg_export_cache_var
Call Stack (most recent call first):
  packages/muelu/CMakeLists.txt:166 (TRIBITS_ADD_OPTION_AND_DEFINE)

But after applying this PR commit patch, the Trilinos configure completes showing:

...

Finished configuring Trilinos!

Total time to configure Trilinos: 0m39.553s
-- If publishing results using Trilinos, please cite us: https://trilinos.github.io/cite.html
-- Configuring done
-- Generating done
-- Build files have been written to: /ascldap/users/rabartl/Trilinos.base/BUILDS/PR/clang-10.0.0

So I am confident this is fixing the problem reported in trilinos/Trilinos#10925

bartlettroscoe added a commit that referenced this pull request Aug 26, 2022
This is a safer way to check for an empty var I have found in the past.
Something strange happens with macro arguments (at least in older versions of
CMake).

This is in response to feedback from @KyleFromKitware while reviewing PR #521.
@bartlettroscoe bartlettroscoe moved this from In Review to Done in TriBITS Refactor Aug 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants