fix(build): set build types in CMake presets - #1772
Conversation
Log: Mark the release and debug presets with their matching CMake build types while preserving the existing C++ optimization and sanitizer flags.
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 123123213weqw The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @123123213weqw. Thanks for your PR. I'm waiting for a OpenAtom-Linyaps member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 51a494d0f2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| "CMAKE_CXX_FLAGS": "-Wall -Wextra -Wpedantic -Wno-c++20-extensions -Wno-pessimizing-move -O2" | ||
| "CMAKE_BUILD_TYPE": "Release", | ||
| "CMAKE_CXX_FLAGS": "-Wall -Wextra -Wpedantic -Wno-c++20-extensions -Wno-pessimizing-move", | ||
| "CMAKE_CXX_FLAGS_RELEASE": "-O2 -DNDEBUG" |
There was a problem hiding this comment.
Select Release for multi-config builds
When CMAKE_GENERATOR selects a multi-config generator such as Ninja Multi-Config, CMAKE_BUILD_TYPE is ignored and cmake --workflow --preset release reaches the existing release build preset without a configuration; CMake therefore builds its default Debug configuration, so the newly configuration-specific -O2 -DNDEBUG flags are never used. This was reproduced with Ninja Multi-Config, where an unqualified cmake --build compiled Debug/main.cpp.o with -g; the installed cmake-presets(7) documentation states that a build preset's configuration is equivalent to passing cmake --build --config. Add "configuration": "Release" to the release build preset, and likewise select Release in the associated test preset.
Useful? React with 👍 / 👎.
Summary
CMAKE_BUILD_TYPE=Releasefor the release presetCMAKE_BUILD_TYPE=Debugfor the debug preset so debug-only project logic is selectedTesting
python3 -m json.tool CMakePresets.jsoncmake --list-presets_FORTIFY_SOURCEremains enabled for release and is no longer enabled for debugThis prevents the debug preset from being treated as a non-Debug build by the top-level CMake logic.