diff options
author | Brad King <brad.king@kitware.com> | 2021-09-16 14:40:40 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-09-17 16:15:11 (GMT) |
commit | 39c5dad0cb67f75e745551ef393316725a4124db (patch) | |
tree | dd25ba070ea457c8cfce01c05c1ce7a490fe6994 /Source | |
parent | 0b7ae84a963307706adaa07d03967db380b98716 (diff) | |
download | CMake-39c5dad0cb67f75e745551ef393316725a4124db.zip CMake-39c5dad0cb67f75e745551ef393316725a4124db.tar.gz CMake-39c5dad0cb67f75e745551ef393316725a4124db.tar.bz2 |
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).
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGlobalNinjaGenerator.cxx | 34 |
1 files 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: |