diff options
author | Alex Turbov <i.zaufi@gmail.com> | 2020-05-04 15:08:40 (GMT) |
---|---|---|
committer | Craig Scott <craig.scott@crascit.com> | 2020-05-06 11:40:36 (GMT) |
commit | e4f1b301fecb9006cdb3153fb3575c6506be9ece (patch) | |
tree | 51bf9c1784ebc9604a9cbf75827e6ec66f7ca483 /Source/cmake.cxx | |
parent | e177e7dbecd3af4ac75ae8db7b726ce9de95a5b8 (diff) | |
download | CMake-e4f1b301fecb9006cdb3153fb3575c6506be9ece.zip CMake-e4f1b301fecb9006cdb3153fb3575c6506be9ece.tar.gz CMake-e4f1b301fecb9006cdb3153fb3575c6506be9ece.tar.bz2 |
cmake: Allow arbitrary args passed to CMake script
Diffstat (limited to 'Source/cmake.cxx')
-rw-r--r-- | Source/cmake.cxx | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx index c95cf4f..d6abd18 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -289,7 +289,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")) { @@ -444,6 +445,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; } |