From 39c5dad0cb67f75e745551ef393316725a4124db Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 16 Sep 2021 10:40:40 -0400 Subject: Ninja: Remove redundant check for GNU-like compiler on Windows Update the Ninja generator's check to work using whatever language is being enabled instead of hard-coding C and CXX. With that, the undocumented internal `CMAKE_COMPILER_IS_MINGW` variable is only set by compilers already covered by other alternatives in the condition. See commit b3de0dfe93 (Ninja: Use forward slashes for any GCC on Windows, 2015-05-07, v3.3.0-rc1~93^2~3). --- Source/cmGlobalNinjaGenerator.cxx | 34 +++++++++++++--------------------- 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index c6f82f9..e2f195f 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -929,29 +929,21 @@ void cmGlobalNinjaGenerator::EnableLanguage( continue; } this->ResolveLanguageCompiler(l, mf, optional); - } #ifdef _WIN32 - const bool clangGnuMode = - ((mf->GetSafeDefinition("CMAKE_C_COMPILER_ID") == "Clang") && - (mf->GetSafeDefinition("CMAKE_C_COMPILER_FRONTEND_VARIANT") == "GNU")) || - ((mf->GetSafeDefinition("CMAKE_CXX_COMPILER_ID") == "Clang") && - (mf->GetSafeDefinition("CMAKE_CXX_COMPILER_FRONTEND_VARIANT") == "GNU")); - - if (clangGnuMode || - ((mf->GetSafeDefinition("CMAKE_C_SIMULATE_ID") != "MSVC") && - (mf->GetSafeDefinition("CMAKE_CXX_SIMULATE_ID") != "MSVC") && - (mf->IsOn("CMAKE_COMPILER_IS_MINGW") || - (mf->GetSafeDefinition("CMAKE_C_COMPILER_ID") == "GNU") || - (mf->GetSafeDefinition("CMAKE_CXX_COMPILER_ID") == "GNU") || - (mf->GetSafeDefinition("CMAKE_C_COMPILER_ID") == "Clang") || - (mf->GetSafeDefinition("CMAKE_CXX_COMPILER_ID") == "Clang") || - (mf->GetSafeDefinition("CMAKE_C_COMPILER_ID") == "ARMClang") || - (mf->GetSafeDefinition("CMAKE_CXX_COMPILER_ID") == "ARMClang") || - (mf->GetSafeDefinition("CMAKE_C_COMPILER_ID") == "QCC") || - (mf->GetSafeDefinition("CMAKE_CXX_COMPILER_ID") == "QCC")))) { - this->UsingGCCOnWindows = true; - } + std::string const& compilerId = + mf->GetSafeDefinition(cmStrCat("CMAKE_", l, "_COMPILER_ID")); + std::string const& simulateId = + mf->GetSafeDefinition(cmStrCat("CMAKE_", l, "_SIMULATE_ID")); + std::string const& compilerFrontendVariant = mf->GetSafeDefinition( + cmStrCat("CMAKE_", l, "_COMPILER_FRONTEND_VARIANT")); + if ((compilerId == "Clang" && compilerFrontendVariant == "GNU") || + (simulateId != "MSVC" && + (compilerId == "GNU" || compilerId == "QCC" || + cmHasLiteralSuffix(compilerId, "Clang")))) { + this->UsingGCCOnWindows = true; + } #endif + } } // Implemented by: -- cgit v0.12