Repository navigation
Replace CMAKE_C_FLAGS with target_compile_options, simplify LTO - #403
Merged
Merged
Conversation
PJK
force-pushed
the
cmake-target-options
branch
from
February 8, 2026 23:49
65a2ed1 to
6ada5f6
Compare
- Create cbor_project_options INTERFACE library for project-wide compile options (warnings, optimization, debug flags) used by tests and examples - Set compile options directly on the cbor target (exported target cannot have PRIVATE INTERFACE library deps in CMake < 3.15) - Guard CMAKE_INTERPROCEDURAL_OPTIMIZATION by LTO_SUPPORTED and remove redundant set_property(DIRECTORY ...) blocks - Sanitizer/coverage flags stay in CMAKE_C_FLAGS (need compile+link, target_link_options requires CMake 3.13) - Remove redundant -DNDEBUG from Release flags (CMake adds it automatically) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
PJK
force-pushed
the
cmake-target-options
branch
from
February 8, 2026 23:49
6ada5f6 to
89eb70b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
cbor_project_optionsINTERFACE library for project-wide compile options (warnings, optimization, debug flags), linked by tests and examplescbortarget (exported targets cannot have PRIVATE INTERFACE library deps in CMake < 3.15)CMAKE_INTERPROCEDURAL_OPTIMIZATIONbyLTO_SUPPORTEDand remove redundantset_property(DIRECTORY ...)blocks — the CMAKE variable already initializes target properties for all subsequently created targets-DNDEBUGfrom Release flags (CMake adds it automatically)CMAKE_C_FLAGSbecause they need both compile and link, andtarget_link_optionsrequires CMake 3.13+Stacked on #402.
Test plan
-DWITH_TESTS=ON -DSANITIZE=ONsucceeds🤖 Generated with Claude Code