-
Notifications
You must be signed in to change notification settings - Fork 37.7k
cmake: Check user-defined APPEND_*FLAGS
variables early
#32367
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
base: master
Are you sure you want to change the base?
Conversation
This change introduces the `bitcoincore_enable_language()` macro to wrap CMake’s `enable_language()` command, applying Bitcoin Core-specific settings and checks.
This change is required for the following commit.
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code Coverage & BenchmarksFor details see: https://corecheck.dev/bitcoin/bitcoin/pulls/32367. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
43ccbb1
to
990067f
Compare
This change improves usability in cases where the user provides `APPEND_*` variables that are incompatible with the compiler for some reason.
990067f
to
eb2a943
Compare
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.
ACK eb2a943
- PR fixes #32323 (reproduced on main, checked it was solved by this PR) ✅
- Code review looks good to me. Adds a new macro with additional checks and some optimisations.✅ (There is one reference to
enable_languages()
in secp256k1 but that is separate and not relevant to this PR )
Main:
Configure with faulty flag:
cmake -B build -DAPPEND_CXXFLAGS="-ftrivial-auto-var-init"
expected config BREAK
Configure with correct flag:
cmake -B build -DAPPEND_CXXFLAGS="-ftrivial-auto-var-init=zero"
not expected: STILL BREAKS
This PR:
Configure with faulty flag
cmake -B build -DAPPEND_CXXFLAGS="-ftrivial-auto-var-init"
expected BREAK
Configure with correct flag
cmake -B build -DAPPEND_CXXFLAGS="-ftrivial-auto-var-init=zero"
config WORKS
🐙 This pull request conflicts with the target branch and needs rebase. |
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.
ACK eb2a943
Confirmed that the new bitcoincore_enable_language(...)
macro properly validates user-defined APPEND_*FLAGS
early via check_source_compiles(...)
, fixing #32323 by catching bad flags during enable_language(...), and removing the need a clean build directory.
(system: macOS 15.6)
(commit: eb2a943)
For the purpose of checks performed by the build system, we strive to handle user-defined
APPEND_*FLAGS
in the same way as flags provided by other standard means. In particular, they are considered when thetry_compile()
command is used.However, these flags are not considered during
enable_language()
command invocation due to design limitations, which might cause issues, such as #32323.This PR addresses the issue by introducing an additional compiler check that does consider the user-defined
APPEND_*FLAGS
.Fixes #32323: