diff options
Diffstat (limited to 'Source/cmGeneratorTarget.cxx')
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 6195d1f..7d43eb1 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -8798,11 +8798,18 @@ cmGeneratorTarget::Cxx20SupportLevel cmGeneratorTarget::HaveCxxModuleSupport( if (!state->GetLanguageEnabled("CXX")) { return Cxx20SupportLevel::MissingCxx; } - cmStandardLevelResolver standardResolver(this->Makefile); - if (!standardResolver.HaveStandardAvailable(this, "CXX", config, - "cxx_std_20")) { - return Cxx20SupportLevel::NoCxx20; - } + cmValue standardDefault = + this->Target->GetMakefile()->GetDefinition("CMAKE_CXX_STANDARD_DEFAULT"); + if (standardDefault && !standardDefault->empty()) { + cmStandardLevelResolver standardResolver(this->Makefile); + if (!standardResolver.HaveStandardAvailable(this, "CXX", config, + "cxx_std_20")) { + return Cxx20SupportLevel::NoCxx20; + } + } + // Else, an empty CMAKE_CXX_STANDARD_DEFAULT means CMake does not detect and + // set a default standard level for this compiler, so assume all standards + // are available. if (!this->Makefile->IsOn("CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP")) { return Cxx20SupportLevel::MissingExperimentalFlag; } |