Skip to content

fix(build): set build types in CMake presets - #1772

Open
123123213weqw wants to merge 1 commit into
OpenAtom-Linyaps:masterfrom
123123213weqw:wangyue/cmake-preset-build-types
Open

fix(build): set build types in CMake presets#1772
123123213weqw wants to merge 1 commit into
OpenAtom-Linyaps:masterfrom
123123213weqw:wangyue/cmake-preset-build-types

Conversation

@123123213weqw

@123123213weqw 123123213weqw commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Summary

  • set CMAKE_BUILD_TYPE=Release for the release preset
  • set CMAKE_BUILD_TYPE=Debug for the debug preset so debug-only project logic is selected
  • keep common warning flags separate from configuration-specific optimization and sanitizer flags

Testing

  • python3 -m json.tool CMakePresets.json
  • cmake --list-presets
  • configured both presets on the Debian 12 build server and verified their cache values
  • verified _FORTIFY_SOURCE remains enabled for release and is no longer enabled for debug

This prevents the debug preset from being treated as a non-Debug build by the top-level CMake logic.

Log: Mark the release and debug presets with their matching CMake build types while preserving the existing C++ optimization and sanitizer flags.
@deepin-ci-robot

Copy link
Copy Markdown
Collaborator

[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.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@deepin-ci-robot

Copy link
Copy Markdown
Collaborator

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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions 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.

@123123213weqw
123123213weqw marked this pull request as ready for review July 28, 2026 03:04

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread CMakePresets.json
"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"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@dengbo11 dengbo11 closed this Jul 30, 2026
@dengbo11 dengbo11 reopened this Jul 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants