diff options
Diffstat (limited to 'Source/cmGlobalGenerator.cxx')
-rw-r--r-- | Source/cmGlobalGenerator.cxx | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 6dabf63..d5207d8 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1038,6 +1038,54 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility( break; } } + + if (compilerId == "LCC") { + switch (mf->GetPolicyStatus(cmPolicies::CMP0129)) { + case cmPolicies::WARN: + if (!this->CMakeInstance->GetIsInTryCompile() && + mf->PolicyOptionalWarningEnabled("CMAKE_POLICY_WARNING_CMP0129")) { + std::ostringstream w; + /* clang-format off */ + w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0129) << "\n" + "Converting " << lang << + R"( compiler id "LCC" to "GNU" for compatibility.)" + ; + /* clang-format on */ + mf->IssueMessage(MessageType::AUTHOR_WARNING, w.str()); + } + CM_FALLTHROUGH; + case cmPolicies::OLD: + // OLD behavior is to convert LCC to GNU. + mf->AddDefinition(compilerIdVar, "GNU"); + if (lang == "C") { + mf->AddDefinition("CMAKE_COMPILER_IS_GNUCC", "1"); + } else if (lang == "CXX") { + mf->AddDefinition("CMAKE_COMPILER_IS_GNUCXX", "1"); + } else if (lang == "Fortran") { + mf->AddDefinition("CMAKE_COMPILER_IS_GNUG77", "1"); + } + { + // Fix compiler versions. + std::string version = "CMAKE_" + lang + "_COMPILER_VERSION"; + std::string emulated = "CMAKE_" + lang + "_SIMULATE_VERSION"; + std::string emulatedId = "CMAKE_" + lang + "_SIMULATE_ID"; + std::string const& actual = mf->GetRequiredDefinition(emulated); + mf->AddDefinition(version, actual); + mf->RemoveDefinition(emulatedId); + mf->RemoveDefinition(emulated); + } + break; + case cmPolicies::REQUIRED_IF_USED: + case cmPolicies::REQUIRED_ALWAYS: + mf->IssueMessage( + MessageType::FATAL_ERROR, + cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0129)); + CM_FALLTHROUGH; + case cmPolicies::NEW: + // NEW behavior is to keep LCC. + break; + } + } } std::string cmGlobalGenerator::GetLanguageOutputExtension( |