mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-20 04:24:36 +08:00
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.
This commit is contained in:
@@ -285,12 +285,12 @@ int do_cmake(int ac, char const* const* av)
|
|||||||
} else if (cmHasLiteralPrefix(av[i], "-P")) {
|
} else if (cmHasLiteralPrefix(av[i], "-P")) {
|
||||||
if (i == ac - 1) {
|
if (i == ac - 1) {
|
||||||
cmSystemTools::Error("No script specified for argument -P");
|
cmSystemTools::Error("No script specified for argument -P");
|
||||||
} else {
|
return 1;
|
||||||
|
}
|
||||||
workingMode = cmake::SCRIPT_MODE;
|
workingMode = cmake::SCRIPT_MODE;
|
||||||
args.push_back(av[i]);
|
args.push_back(av[i]);
|
||||||
i++;
|
i++;
|
||||||
args.push_back(av[i]);
|
args.push_back(av[i]);
|
||||||
}
|
|
||||||
} else if (cmHasLiteralPrefix(av[i], "--find-package")) {
|
} else if (cmHasLiteralPrefix(av[i], "--find-package")) {
|
||||||
workingMode = cmake::FIND_PACKAGE_MODE;
|
workingMode = cmake::FIND_PACKAGE_MODE;
|
||||||
args.push_back(av[i]);
|
args.push_back(av[i]);
|
||||||
|
Reference in New Issue
Block a user