diff options
author | Kyle Edwards <kyle.edwards@kitware.com> | 2020-02-26 21:37:30 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2020-02-27 14:23:08 (GMT) |
commit | 9590c3a400cc16882fee860818cfdcca82e17a37 (patch) | |
tree | 5f1347d554c0d4ff6eac58aca3848ee7106e1c5a /Source/cmGlobalGenerator.cxx | |
parent | 7a63dafafbc666a184a007adca5b138796384f77 (diff) | |
download | CMake-9590c3a400cc16882fee860818cfdcca82e17a37.zip CMake-9590c3a400cc16882fee860818cfdcca82e17a37.tar.gz CMake-9590c3a400cc16882fee860818cfdcca82e17a37.tar.bz2 |
Generator: Don't allow Ninja Multi-Config variables on other generators
We may want to enable these variables later on with specific
semantics. To avoid breaking backwards compatibility, make it an
error to use them for now.
Diffstat (limited to 'Source/cmGlobalGenerator.cxx')
-rw-r--r-- | Source/cmGlobalGenerator.cxx | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index ff6ad9d..0404715 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1361,8 +1361,43 @@ void cmGlobalGenerator::ComputeBuildFileGenerators() } } +bool cmGlobalGenerator::UnsupportedVariableIsDefined(const std::string& name, + bool supported) const +{ + if (!supported && this->Makefiles.front()->GetDefinition(name)) { + std::ostringstream e; + /* clang-format off */ + e << + "Generator\n" + " " << this->GetName() << "\n" + "does not support variable\n" + " " << name << "\n" + "but it has been specified." + ; + /* clang-format on */ + this->GetCMakeInstance()->IssueMessage(MessageType::FATAL_ERROR, e.str()); + return true; + } + + return false; +} + bool cmGlobalGenerator::Compute() { + // Make sure unsupported variables are not used. + if (this->UnsupportedVariableIsDefined("CMAKE_DEFAULT_BUILD_TYPE", + this->SupportsDefaultBuildType())) { + return false; + } + if (this->UnsupportedVariableIsDefined("CMAKE_CROSS_CONFIGS", + this->SupportsCrossConfigs())) { + return false; + } + if (this->UnsupportedVariableIsDefined("CMAKE_DEFAULT_CONFIGS", + this->SupportsDefaultConfigs())) { + return false; + } + // Some generators track files replaced during the Generate. // Start with an empty vector: this->FilesReplacedDuringGenerate.clear(); |