diff options
author | Brad King <brad.king@kitware.com> | 2019-02-28 16:41:32 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2019-02-28 16:41:43 (GMT) |
commit | bfd71fc05c8495d9afefc920f2d59776b184098c (patch) | |
tree | 1436f3a8fcd3071375821e3fb8339dee2fd84a84 /Source | |
parent | 4a79cdc85f885abfde9c3da393a55ef8ec947637 (diff) | |
parent | c7213ca87064ba47984b4dd07192389366d5856a (diff) | |
download | CMake-bfd71fc05c8495d9afefc920f2d59776b184098c.zip CMake-bfd71fc05c8495d9afefc920f2d59776b184098c.tar.gz CMake-bfd71fc05c8495d9afefc920f2d59776b184098c.tar.bz2 |
Merge topic 'features-from-default-standard'
c7213ca870 Features: Do not use a lower-than-default standard for requested features
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3023
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmMakefile.cxx | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index a0b09da..ab37774 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -4725,6 +4725,13 @@ bool cmMakefile::AddRequiredTargetCxxFeature(cmTarget* target, needCxx17, needCxx20); const char* existingCxxStandard = target->GetProperty("CXX_STANDARD"); + if (existingCxxStandard == nullptr) { + const char* defaultCxxStandard = + this->GetDefinition("CMAKE_CXX_STANDARD_DEFAULT"); + if (defaultCxxStandard && *defaultCxxStandard) { + existingCxxStandard = defaultCxxStandard; + } + } const char* const* existingCxxLevel = nullptr; if (existingCxxStandard) { existingCxxLevel = @@ -4827,6 +4834,13 @@ bool cmMakefile::AddRequiredTargetCFeature(cmTarget* target, this->CheckNeededCLanguage(feature, needC90, needC99, needC11); const char* existingCStandard = target->GetProperty("C_STANDARD"); + if (existingCStandard == nullptr) { + const char* defaultCStandard = + this->GetDefinition("CMAKE_C_STANDARD_DEFAULT"); + if (defaultCStandard && *defaultCStandard) { + existingCStandard = defaultCStandard; + } + } if (existingCStandard) { if (std::find_if(cm::cbegin(C_STANDARDS), cm::cend(C_STANDARDS), cmStrCmp(existingCStandard)) == cm::cend(C_STANDARDS)) { |