-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
cmake: Treat pristine build warnings as errors #77843
base: main
Are you sure you want to change the base?
Conversation
A pristine build is needed when snippets are changed. Currently this only triggers a warning which can easily be missed. Signed-off-by: Andriy Gelman <[email protected]>
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.
LGTM. The more stuff that doesn't silently fail, the better.
@@ -3328,7 +3328,7 @@ function(zephyr_check_cache variable) | |||
# without cleaning first | |||
if(cli_argument) | |||
if(NOT ((CACHED_${variable} STREQUAL cli_argument) OR (${variable}_DEPRECATED STREQUAL cli_argument))) | |||
message(WARNING "The build directory must be cleaned pristinely when " | |||
message(FATAL_ERROR "The build directory must be cleaned pristinely when " |
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.
this is not only impacting snippets but is impacting every setting which are not allowed to be changed, including BOARD
and SHIELD
.
Thus I believe a broader audience should be included if we're to change the build system behavior.
Also. if this is changed to an error, then the following code, which becomes dead code with the proposed change, should be cleaned up in addition.
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.
I'll have a look at cleaning up the following code. Also changed the title to take into account your feedback.
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.
another, and perhaps better alternative, is to change from WARNING
to AUTHOR_WARNING
.
That will allow developers to error on warnings by calling cmake with: -Werror=dev
, while still keeping it a warning for others.
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.
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.
not sure why west build
decided to error out early on board, but zephyr_check_cache
is a common available Zephyr CMake extension function which can used elsewhere, even by downstream projects / modules.
Didn't think through the implications properly.
A pristine build is needed when snippets are changed. Currently, this only triggers a warning which can easily be missed and the new target snippets won't be applied.Make the warning an error.
A pristine build is needed when snippets/boards/shields are changed. Currently, this is treated as a warning which can be easily missed and the new settings won't be applied. Treat the warning as an error.