diff options
author | Brad King <brad.king@kitware.com> | 2022-11-11 13:19:40 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2022-11-11 13:19:50 (GMT) |
commit | f3f79be9580a9ae3802d7adf02eb9d2319af527a (patch) | |
tree | 69ba39b7e0036adee13d575edf87485738af95c5 | |
parent | b31196f1d7abb9f1ed64190dfc69479fffb607a7 (diff) | |
parent | 5e7c8f44ac7d0157d234544e7ec903910985a0fa (diff) | |
download | CMake-f3f79be9580a9ae3802d7adf02eb9d2319af527a.zip CMake-f3f79be9580a9ae3802d7adf02eb9d2319af527a.tar.gz CMake-f3f79be9580a9ae3802d7adf02eb9d2319af527a.tar.bz2 |
Merge topic 'fix-cxx20-detection' into release-3.25
5e7c8f44ac Ninja: Restore support for compilers not defining a C++ standard level
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Acked-by: Jaeden Amero <kitware@patater.com>
Acked-by: Martin Kojtal <martin.kojtal@arm.com>
Merge-request: !7896
-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; } |