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

Implement and use tribits_[advanced_]set_with_default_override() #570

Open
bartlettroscoe opened this issue Mar 29, 2023 · 1 comment
Open

Comments

@bartlettroscoe
Copy link
Member

bartlettroscoe commented Mar 29, 2023

Description

A common idiom used with TriBITS is to define a cache var with the framework that allows the project to define an override as a non-cache var. The idiom looks like this:

if (NOT "${<varName>_DEFAULT}" STREQUAL "")
  set(<varName>_DEFAULT <defaultVal>)
endif()
advanced_set(<varName> "${<varName>_DEFAULT}" CACHE <type> "<docString>")

The set of TriBITS framework-level vars that have project-level default overrides are listed here.

The function that would be added for this is:

tribits_advanced_set_with_default_override(<varName> <defaultVal> CACHE <type> "<docString>")

(where advanced_set() is deprecated and used properly namespaced tribits_advanced_set()).

And there could also be a function of a non-advanced cache var with:

tribits_set_with_default_override(<varName> <defaultVal> CACHE <type> "<docString>")

This would cut down on a lot of boilerplate code and provide some more uniformity.

NOTE: This was suggested by @KyleFromKitware in #560 (comment).

@bartlettroscoe
Copy link
Member Author

This has been started in PR #591.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: In Progress
Development

No branches or pull requests

1 participant