toolchain_overridable_option() : user + toolchain overridable project options()s #32
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This provides project options that can be overriden in cmake toolchain files, or can be marked as NON_OVERRIDABLE in toolchains files to error out if an user tries to override settings that should not be overriden from toolchain files.
It is meant to replace option() in project with a reliable and constant behaviour even when CMP077 is off.
It behaves with the following priority :
The tracking of the default option allows user to get a warning whenever the previous default of an user-overriden option changes.
This module exists to permit :
Rationale
Before CMake 3.13 if set() was used without CACHE the value would not be taken by option(), leading to a reconfiguration changing the toolchain prescribed value on the first build.
Also this leads to using CACHE FORCE because otherwise any modification of the value in the toolchain file would not be taken in an already configured build tree, requiring full rebuilds to test a simple toolchain value change.
Finally the new behaviour of option() since CMP0077 is for option() to respect scope variables in priority. This makes essentially plain option() set in a toolchain file non-overridable on the command line, as the cmake -D command line sets CACHE variables.
Usage:
Change-Id: I4f1f00d71039288eb344b8a0969fa12ed1091224