summaryrefslogtreecommitdiffstats
path: root/Source/cmake.cxx
diff options
context:
space:
mode:
authorCraig Scott <craig.scott@crascit.com>2020-05-07 13:09:40 (GMT)
committerKitware Robot <kwrobot@kitware.com>2020-05-07 13:09:52 (GMT)
commitb743ffbfa2b10709338c970037b5a663e375509d (patch)
tree7bbc8fc089d0c373c65f86f00c9a4632365c483c /Source/cmake.cxx
parent51d82407fcd35a8995df194e5f6dd9d9eb3acd01 (diff)
parente4f1b301fecb9006cdb3153fb3575c6506be9ece (diff)
downloadCMake-b743ffbfa2b10709338c970037b5a663e375509d.zip
CMake-b743ffbfa2b10709338c970037b5a663e375509d.tar.gz
CMake-b743ffbfa2b10709338c970037b5a663e375509d.tar.bz2
Merge topic 'script-mode-and-arbitrary-args'
e4f1b301fe cmake: Allow arbitrary args passed to CMake script Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4707
Diffstat (limited to 'Source/cmake.cxx')
-rw-r--r--Source/cmake.cxx8
1 files changed, 7 insertions, 1 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 057d54d..b451d27 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -291,7 +291,8 @@ void cmake::CleanupCommandsAndMacros()
// Parse the args
bool cmake::SetCacheArgs(const std::vector<std::string>& args)
{
- bool findPackageMode = false;
+ auto findPackageMode = false;
+ auto seenScriptOption = false;
for (unsigned int i = 1; i < args.size(); ++i) {
std::string const& arg = args[i];
if (cmHasLiteralPrefix(arg, "-D")) {
@@ -446,6 +447,11 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
this->SetHomeOutputDirectory(
cmSystemTools::GetCurrentWorkingDirectory());
this->ReadListFile(args, path);
+ seenScriptOption = true;
+ } else if (arg == "--" && seenScriptOption) {
+ // Stop processing CMake args and avoid possible errors
+ // when arbitrary args are given to CMake script.
+ break;
} else if (cmHasLiteralPrefix(arg, "--find-package")) {
findPackageMode = true;
}