diff options
author | Robert Maynard <rmaynard@nvidia.com> | 2023-02-08 21:38:21 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2023-02-08 22:21:10 (GMT) |
commit | f9e8a067c254c711d8628356c23c402882557058 (patch) | |
tree | 418f430ba416a9390401e66f48d63e6d8b125713 /Source/cmakemain.cxx | |
parent | 2a0c105cf08190284b288057c693eeddef5066fc (diff) | |
download | CMake-f9e8a067c254c711d8628356c23c402882557058.zip CMake-f9e8a067c254c711d8628356c23c402882557058.tar.gz CMake-f9e8a067c254c711d8628356c23c402882557058.tar.bz2 |
cmake: Stop parsing after `--` when detecting script mode
The fix in commit 08aa516880 (cmake: Stop parsing after `--` when
detecting script mode, 2022-12-06, v3.26.0-rc1~216^2) only corrected the
case where `-P -- -P <arg>` occurred and not `-P -- -P -<other>`.
Fixes: #24220
Diffstat (limited to 'Source/cmakemain.cxx')
-rw-r--r-- | Source/cmakemain.cxx | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index 1e02412..f4e602b 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -303,6 +303,13 @@ int do_cmake(int ac, char const* const* av) for (decltype(inputArgs.size()) i = 0; i < inputArgs.size(); ++i) { std::string const& arg = inputArgs[i]; bool matched = false; + + // Only in script mode do we stop parsing instead + // of preferring the last mode flag provided + if (arg == "--" && workingMode == cmake::SCRIPT_MODE) { + parsedArgs = inputArgs; + break; + } for (auto const& m : arguments) { if (m.matches(arg)) { matched = true; @@ -311,11 +318,6 @@ int do_cmake(int ac, char const* const* av) } return 1; // failed to parse } - // Only in script mode do we stop parsing instead - // of preferring the last mode flag provided - if (arg == "--" && workingMode == cmake::SCRIPT_MODE) { - break; - } } if (!matched) { parsedArgs.emplace_back(av[i]); |