summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-08-07 15:53:28 (GMT)
committerKitware Robot <kwrobot@kitware.com>2023-08-07 15:53:39 (GMT)
commitade507f64caad8f763ae011da4bdf99453e8bcd8 (patch)
tree22ddde70f2e4af75bab28fb4bc58180697d6e286 /Source
parent9a849fcec4bfe29286d61741ff545765137597c3 (diff)
parent20c23518d9947325198c727c77860d3877f61de5 (diff)
downloadCMake-ade507f64caad8f763ae011da4bdf99453e8bcd8.zip
CMake-ade507f64caad8f763ae011da4bdf99453e8bcd8.tar.gz
CMake-ade507f64caad8f763ae011da4bdf99453e8bcd8.tar.bz2
Merge topic 'set-CACHE-diagnostics'
20c23518d9 set: Improve diagnostics for CACHE mode Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Merge-request: !8679
Diffstat (limited to 'Source')
-rw-r--r--Source/cmSetCommand.cxx16
1 files changed, 12 insertions, 4 deletions
diff --git a/Source/cmSetCommand.cxx b/Source/cmSetCommand.cxx
index c4bb949..c98745a 100644
--- a/Source/cmSetCommand.cxx
+++ b/Source/cmSetCommand.cxx
@@ -115,10 +115,18 @@ bool cmSetCommand(std::vector<std::string> const& args,
// we should be nice and try to catch some simple screwups if the last or
// next to last args are CACHE then they screwed up. If they used FORCE
// without CACHE they screwed up
- if ((args.back() == "CACHE") ||
- (args.size() > 1 && args[args.size() - 2] == "CACHE") ||
- (force && !cache)) {
- status.SetError("given invalid arguments for CACHE mode.");
+ if (args.back() == "CACHE") {
+ status.SetError(
+ "given invalid arguments for CACHE mode: missing type and docstring");
+ return false;
+ }
+ if (args.size() > 1 && args[args.size() - 2] == "CACHE") {
+ status.SetError(
+ "given invalid arguments for CACHE mode: missing type or docstring");
+ return false;
+ }
+ if (force && !cache) {
+ status.SetError("given invalid arguments: FORCE specified without CACHE");
return false;
}