summaryrefslogtreecommitdiffstats
path: root/Source/cmake.cxx
diff options
context:
space:
mode:
authorCraig Scott <craig.scott@crascit.com>2019-10-09 12:55:43 (GMT)
committerBrad King <brad.king@kitware.com>2019-10-10 13:20:50 (GMT)
commit7bbddeb78d46193eda9c2a948040e50012fbe33b (patch)
treef4255eca8b53009ac3414d02fabc1f9b673e08b5 /Source/cmake.cxx
parentead89868ba09bb331ae31c116f1cec4a44713b3b (diff)
downloadCMake-7bbddeb78d46193eda9c2a948040e50012fbe33b.zip
CMake-7bbddeb78d46193eda9c2a948040e50012fbe33b.tar.gz
CMake-7bbddeb78d46193eda9c2a948040e50012fbe33b.tar.bz2
CLI: Rename --loglevel to --log-level for naming consistency
Other multi-word command line options use hyphens to separate the words, so the --loglevel option introduced in CMake 3.15 was inconsistent in this regard. Rename it to --log-level but still support the original --loglevel name to preserve backward compatibility.
Diffstat (limited to 'Source/cmake.cxx')
-rw-r--r--Source/cmake.cxx11
1 files changed, 11 insertions, 0 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 02606c2..50f47af 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -725,7 +725,18 @@ void cmake::SetArgs(const std::vector<std::string>& args)
} else if (arg.find("--debug-output", 0) == 0) {
std::cout << "Running with debug output on.\n";
this->SetDebugOutputOn(true);
+ } else if (arg.find("--log-level=", 0) == 0) {
+ const auto logLevel =
+ StringToLogLevel(arg.substr(sizeof("--log-level=") - 1));
+ if (logLevel == LogLevel::LOG_UNDEFINED) {
+ cmSystemTools::Error("Invalid level specified for --log-level");
+ return;
+ }
+ this->SetLogLevel(logLevel);
} else if (arg.find("--loglevel=", 0) == 0) {
+ // This is supported for backward compatibility. This option only
+ // appeared in the 3.15.x release series and was renamed to
+ // --log-level in 3.16.0
const auto logLevel =
StringToLogLevel(arg.substr(sizeof("--loglevel=") - 1));
if (logLevel == LogLevel::LOG_UNDEFINED) {