summaryrefslogtreecommitdiffstats
path: root/Source/cmakemain.cxx
diff options
context:
space:
mode:
authorCraig Scott <craig.scott@crascit.com>2019-01-13 12:26:56 (GMT)
committerCraig Scott <craig.scott@crascit.com>2019-01-13 20:13:27 (GMT)
commita1adbc724336b0a4185e34b63e18de03a8b119cf (patch)
treecd3886269c4f52651488e27ba0aa81db93b65f57 /Source/cmakemain.cxx
parent91fa6a472cd262014a74d765b003bb1cc9d7ab8a (diff)
downloadCMake-a1adbc724336b0a4185e34b63e18de03a8b119cf.zip
CMake-a1adbc724336b0a4185e34b63e18de03a8b119cf.tar.gz
CMake-a1adbc724336b0a4185e34b63e18de03a8b119cf.tar.bz2
cmake: Stop processing if -P option lacks file name
While an error message was being logged, processing was continuing nonetheless except with the -P argument omitted. This could have allowed unintended effects if the remaining arguments formed a valid set of command line options.
Diffstat (limited to 'Source/cmakemain.cxx')
-rw-r--r--Source/cmakemain.cxx10
1 files changed, 5 insertions, 5 deletions
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index 75dabde..e52f2b3 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -285,12 +285,12 @@ int do_cmake(int ac, char const* const* av)
} else if (cmHasLiteralPrefix(av[i], "-P")) {
if (i == ac - 1) {
cmSystemTools::Error("No script specified for argument -P");
- } else {
- workingMode = cmake::SCRIPT_MODE;
- args.push_back(av[i]);
- i++;
- args.push_back(av[i]);
+ return 1;
}
+ workingMode = cmake::SCRIPT_MODE;
+ args.push_back(av[i]);
+ i++;
+ args.push_back(av[i]);
} else if (cmHasLiteralPrefix(av[i], "--find-package")) {
workingMode = cmake::FIND_PACKAGE_MODE;
args.push_back(av[i]);