summaryrefslogtreecommitdiff
path: root/Source/cmGeneratorTarget.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-11-11 13:19:40 +0000
committerKitware Robot <kwrobot@kitware.com>2022-11-11 08:19:51 -0500
commit7338a6988105231a39a64caa0f3480f8bdfbaa9b (patch)
tree216cbf5a19f8d30481c89eff4ef23eda4df16350 /Source/cmGeneratorTarget.cxx
parentaab6022307d2f8ad914ba446a0852254d3a76a3a (diff)
parent5e7c8f44ac7d0157d234544e7ec903910985a0fa (diff)
downloadcmake-7338a6988105231a39a64caa0f3480f8bdfbaa9b.tar.gz
Merge topic 'fix-cxx20-detection'
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
Diffstat (limited to 'Source/cmGeneratorTarget.cxx')
-rw-r--r--Source/cmGeneratorTarget.cxx17
1 files changed, 12 insertions, 5 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 8fd7321533..becf2447f7 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -8803,11 +8803,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;
}