diff options
author | Jeremy <51220084+jeremy-rifkin@users.noreply.github.com> | 2023-08-02 00:29:58 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2023-08-02 14:07:56 (GMT) |
commit | 20c23518d9947325198c727c77860d3877f61de5 (patch) | |
tree | 3bb5210f61a3bde80872d2063f8580ea896ff926 /Source | |
parent | 17dcd9424aefdfa10b72ad3d3bfe35e186cad02b (diff) | |
download | CMake-20c23518d9947325198c727c77860d3877f61de5.zip CMake-20c23518d9947325198c727c77860d3877f61de5.tar.gz CMake-20c23518d9947325198c727c77860d3877f61de5.tar.bz2 |
set: Improve diagnostics for CACHE mode
Improve `set()` diagnostics to be more specific than
given invalid arguments for CACHE mode
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmSetCommand.cxx | 16 |
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; } |