mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-25 15:49:08 -05:00
cxxmodules: Scan only targets that explicitly enable C++ 20
Previously we scanned any targets for which C++ 20 is enabled, even if enabled only by the compiler's default, such as when `CXXFLAGS=-std=c++20`.
This commit is contained in:
@@ -9142,13 +9142,11 @@ cmGeneratorTarget::Cxx20SupportLevel cmGeneratorTarget::HaveCxxModuleSupport(
|
||||
}
|
||||
|
||||
cmStandardLevelResolver standardResolver(this->Makefile);
|
||||
if (!standardResolver.HaveStandardAvailable(this, "CXX", config,
|
||||
"cxx_std_20") ||
|
||||
// During the ABI detection step we do not know the compiler's features.
|
||||
// HaveStandardAvailable may return true as a fallback, but in this code
|
||||
// path we do not want to assume C++ 20 is available.
|
||||
this->Makefile->GetDefinition("CMAKE_CXX20_COMPILE_FEATURES")
|
||||
.IsEmpty()) {
|
||||
cmStandardLevel const cxxStd20 =
|
||||
*standardResolver.LanguageStandardLevel("CXX", "20");
|
||||
cm::optional<cmStandardLevel> explicitLevel =
|
||||
this->GetExplicitStandardLevel("CXX", config);
|
||||
if (!explicitLevel || *explicitLevel < cxxStd20) {
|
||||
return Cxx20SupportLevel::NoCxx20;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user