diff options
author | Brad King <brad.king@kitware.com> | 2018-04-02 14:00:00 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2018-04-02 14:01:23 (GMT) |
commit | 1b6ec4b9e34a06c047cb41245587673959b5b591 (patch) | |
tree | 4945534c7f8b71ea81c4a9c708e2531d907e275c /Source | |
parent | 5d5e1e691772ecfd9224be0afe33802f8aee3fc3 (diff) | |
parent | 8570dc7f64928ec7896197394f089f5ad063c6ca (diff) | |
download | CMake-1b6ec4b9e34a06c047cb41245587673959b5b591.zip CMake-1b6ec4b9e34a06c047cb41245587673959b5b591.tar.gz CMake-1b6ec4b9e34a06c047cb41245587673959b5b591.tar.bz2 |
Merge topic 'features-c++20'
8570dc7f64 Help: Update compiler versions in cmake-compile-features.7.rst
874d3d2948 Help: Add release note for C++ 20 support
7f295b1bd3 Features: Activate C++ 20 support for Clang 5.0+
71cb8ce3a1 Features: Activate C++ 20 support for GNU 8.0+
8f146c4508 Features: Activate C++ 20 support for MSVC 19.12.25835+
7fe580a362 Features: Add infrastructure for C++ 20 language standard
1b328e09a3 Features: Use -std=c++17 for C++ 17 on Clang 5.0+
0bc3e5788a Features: Use -std=c++17 for C++ 17 on GNU 8.0+
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1892
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmLocalGenerator.cxx | 1 | ||||
-rw-r--r-- | Source/cmMakefile.cxx | 23 | ||||
-rw-r--r-- | Source/cmMakefile.h | 2 | ||||
-rw-r--r-- | Source/cmake.h | 1 |
4 files changed, 20 insertions, 7 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index e942ff4..629d54a 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1561,6 +1561,7 @@ void cmLocalGenerator::AddCompilerRequirementFlag( static std::map<std::string, std::vector<std::string>> langStdMap; if (langStdMap.empty()) { // Maintain sorted order, most recent first. + langStdMap["CXX"].push_back("20"); langStdMap["CXX"].push_back("17"); langStdMap["CXX"].push_back("14"); langStdMap["CXX"].push_back("11"); diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index c270629..3ecd7eb 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -4223,7 +4223,7 @@ static const char* const CXX_FEATURES[] = { nullptr FOR_EACH_CXX_FEATURE( #undef FEATURE_STRING static const char* const C_STANDARDS[] = { "90", "99", "11" }; -static const char* const CXX_STANDARDS[] = { "98", "11", "14", "17" }; +static const char* const CXX_STANDARDS[] = { "98", "11", "14", "17", "20" }; bool cmMakefile::AddRequiredTargetFeature(cmTarget* target, const std::string& feature, @@ -4473,8 +4473,9 @@ bool cmMakefile::HaveCxxStandardAvailable(cmTarget const* target, bool needCxx11 = false; bool needCxx14 = false; bool needCxx17 = false; + bool needCxx20 = false; this->CheckNeededCxxLanguage(feature, needCxx98, needCxx11, needCxx14, - needCxx17); + needCxx17, needCxx20); const char* existingCxxStandard = target->GetProperty("CXX_STANDARD"); if (!existingCxxStandard) { @@ -4494,7 +4495,8 @@ bool cmMakefile::HaveCxxStandardAvailable(cmTarget const* target, /* clang-format off */ const char* const* needCxxLevel = - needCxx17 ? &CXX_STANDARDS[3] + needCxx20 ? &CXX_STANDARDS[4] + : needCxx17 ? &CXX_STANDARDS[3] : needCxx14 ? &CXX_STANDARDS[2] : needCxx11 ? &CXX_STANDARDS[1] : needCxx98 ? &CXX_STANDARDS[0] @@ -4506,7 +4508,8 @@ bool cmMakefile::HaveCxxStandardAvailable(cmTarget const* target, void cmMakefile::CheckNeededCxxLanguage(const std::string& feature, bool& needCxx98, bool& needCxx11, - bool& needCxx14, bool& needCxx17) const + bool& needCxx14, bool& needCxx17, + bool& needCxx20) const { if (const char* propCxx98 = this->GetDefinition("CMAKE_CXX98_COMPILE_FEATURES")) { @@ -4532,6 +4535,12 @@ void cmMakefile::CheckNeededCxxLanguage(const std::string& feature, cmSystemTools::ExpandListArgument(propCxx17, props); needCxx17 = std::find(props.begin(), props.end(), feature) != props.end(); } + if (const char* propCxx20 = + this->GetDefinition("CMAKE_CXX20_COMPILE_FEATURES")) { + std::vector<std::string> props; + cmSystemTools::ExpandListArgument(propCxx20, props); + needCxx20 = std::find(props.begin(), props.end(), feature) != props.end(); + } } bool cmMakefile::AddRequiredTargetCxxFeature(cmTarget* target, @@ -4542,9 +4551,10 @@ bool cmMakefile::AddRequiredTargetCxxFeature(cmTarget* target, bool needCxx11 = false; bool needCxx14 = false; bool needCxx17 = false; + bool needCxx20 = false; this->CheckNeededCxxLanguage(feature, needCxx98, needCxx11, needCxx14, - needCxx17); + needCxx17, needCxx20); const char* existingCxxStandard = target->GetProperty("CXX_STANDARD"); const char* const* existingCxxLevel = nullptr; @@ -4589,7 +4599,8 @@ bool cmMakefile::AddRequiredTargetCxxFeature(cmTarget* target, /* clang-format off */ const char* const* needCxxLevel = - needCxx17 ? &CXX_STANDARDS[3] + needCxx20 ? &CXX_STANDARDS[4] + : needCxx17 ? &CXX_STANDARDS[3] : needCxx14 ? &CXX_STANDARDS[2] : needCxx11 ? &CXX_STANDARDS[1] : needCxx98 ? &CXX_STANDARDS[0] diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 419cb6e..d2626cd 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -991,7 +991,7 @@ private: bool& needC99, bool& needC11) const; void CheckNeededCxxLanguage(const std::string& feature, bool& needCxx98, bool& needCxx11, bool& needCxx14, - bool& needCxx17) const; + bool& needCxx17, bool& needCxx20) const; bool HaveCStandardAvailable(cmTarget const* target, const std::string& feature) const; diff --git a/Source/cmake.h b/Source/cmake.h index 1ac549b..cc56a07 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -574,6 +574,7 @@ private: F(cxx_std_11) \ F(cxx_std_14) \ F(cxx_std_17) \ + F(cxx_std_20) \ F(cxx_aggregate_default_initializers) \ F(cxx_alias_templates) \ F(cxx_alignas) \ |