cmake: parse EXTRAFLAGS with separate_arguments - #20021
Open
r3wretrhy wants to merge 1 commit into
Open
Conversation
r3wretrhy
force-pushed
the
cmake-extraflags-separate-arguments
branch
2 times, most recently
from
August 31, 2026 09:00
baccc68 to
e61f060
Compare
xiaoxiang781216
approved these changes
Aug 31, 2026
string(REPLACE) splits on every space, so a flag such as -I"/path with spaces" becomes several bogus compile options. Use separate_arguments(UNIX_COMMAND), matching EXTRA_FLAGS. Signed-off-by: Zhaoqi Xu <lzy00419@outlook.com>
r3wretrhy
force-pushed
the
cmake-extraflags-separate-arguments
branch
from
August 31, 2026 09:22
e61f060 to
8da56b4
Compare
anchao
approved these changes
Aug 31, 2026
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.
cmake: parse EXTRAFLAGS with separate_arguments.
Summary
Impact
Testing
I confirm that changes are verified on local setup and works as intended:
Testing logs before change:
EXTRAFLAGS=-Wno-cpp -Werror -I"/tmp/path with spaces/include" string(REPLACE " " ";") OLD_LEN=5 OLD_ITEM=[-Wno-cpp] OLD_ITEM=[-Werror] OLD_ITEM=[-I"/tmp/path] OLD_ITEM=[with] OLD_ITEM=[spaces/include"]Testing logs after change:
separate_arguments(UNIX_COMMAND) NEW_LEN=3 NEW_ITEM=[-Wno-cpp] NEW_ITEM=[-Werror] NEW_ITEM=[-I/tmp/path with spaces/include] EXTRAFLAGS_PARSE_OKPR verification Self-Check