diff options
author | Brad King <brad.king@kitware.com> | 2024-06-13 16:09:06 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2024-06-14 12:24:21 (GMT) |
commit | 9b672e8075553a981a12cda956fcfc189636f449 (patch) | |
tree | 1dc2811123059ea19e6a6b632836f1e82814a398 /Source | |
parent | 7c6dcba6469df72effb9acebf2b947df33bb28ad (diff) | |
download | CMake-9b672e8075553a981a12cda956fcfc189636f449.zip CMake-9b672e8075553a981a12cda956fcfc189636f449.tar.gz CMake-9b672e8075553a981a12cda956fcfc189636f449.tar.bz2 |
VS: Quote custom command arguments containing semicolons
The `GoogleTest` module needs this to pass the `TEST_EXECUTOR`
definition to its `GoogleTestAddTests.cmake` helper script in
the `POST_BUILD` command since commit f875c479f5 (GoogleTest: Honor
TEST_LAUNCHER in gtest_discover_tests, 2024-01-17, v3.29.0-rc1~34^2).
Previously it worked only if other characters, such as spaces,
caused the argument to be quoted. This was exposed by running the
`RunCMake.GoogleTest` test in a path without spaces.
Reported-by: Garrett Campbell <gcampbell@microsoft.com>
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmOutputConverter.cxx | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx index f4a8d0c..9aac273 100644 --- a/Source/cmOutputConverter.cxx +++ b/Source/cmOutputConverter.cxx @@ -450,7 +450,8 @@ bool cmOutputConverter::Shell_CharNeedsQuotes(char c, int flags) } } else { /* On Windows several special characters need quotes to preserve them. */ - if (Shell_CharNeedsQuotesOnWindows(c)) { + if (Shell_CharNeedsQuotesOnWindows(c) || + (c == ';' && (flags & Shell_Flag_VSIDE))) { return true; } } @@ -670,11 +671,8 @@ std::string cmOutputConverter::Shell_GetArgument(cm::string_view in, int flags) } } else if (*cit == ';') { if (flags & Shell_Flag_VSIDE) { - /* In a VS IDE a semicolon is written ";". If this is written - in an un-quoted argument it starts a quoted segment, - inserts the ; and ends the segment. If it is written in a - quoted argument it ends quoting, inserts the ; and restarts - quoting. Either way the ; is isolated. */ + /* In VS a semicolon is written `";"` inside a quoted argument. + It ends quoting, inserts the `;`, and restarts quoting. */ out += "\";\""; } else { /* Otherwise a semicolon is written just ;. */ |