diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmLocalGenerator.cxx | 1 | ||||
-rw-r--r-- | Source/cmMakefile.cxx | 33 | ||||
-rw-r--r-- | Source/cmMakefile.h | 2 | ||||
-rw-r--r-- | Source/cmake.h | 11 |
4 files changed, 41 insertions, 6 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index e80b8ee..f83981e 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -2222,6 +2222,7 @@ AddCompilerRequirementFlag(std::string &flags, cmTarget* target, if (langStdMap.empty()) { // Maintain sorted order, most recent first. + langStdMap["CXX"].push_back("14"); langStdMap["CXX"].push_back("11"); langStdMap["CXX"].push_back("98"); diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index aca7a93..2620471 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -4987,6 +4987,7 @@ static const char * const C_STANDARDS[] = { static const char * const CXX_STANDARDS[] = { "98" , "11" + , "14" }; //---------------------------------------------------------------------------- @@ -5209,7 +5210,8 @@ bool cmMakefile::HaveCxxFeatureAvailable(cmTarget const* target, { bool needCxx98 = false; bool needCxx11 = false; - this->CheckNeededCxxLanguage(feature, needCxx98, needCxx11); + bool needCxx14 = false; + this->CheckNeededCxxLanguage(feature, needCxx98, needCxx11, needCxx14); const char *existingCxxStandard = target->GetProperty("CXX_STANDARD"); if (!existingCxxStandard) @@ -5252,7 +5254,8 @@ bool cmMakefile::HaveCxxFeatureAvailable(cmTarget const* target, //---------------------------------------------------------------------------- void cmMakefile::CheckNeededCxxLanguage(const std::string& feature, bool& needCxx98, - bool& needCxx11) const + bool& needCxx11, + bool& needCxx14) const { if (const char *propCxx98 = this->GetDefinition("CMAKE_CXX98_COMPILE_FEATURES")) @@ -5268,6 +5271,13 @@ void cmMakefile::CheckNeededCxxLanguage(const std::string& feature, cmSystemTools::ExpandListArgument(propCxx11, props); needCxx11 = std::find(props.begin(), props.end(), feature) != props.end(); } + if (const char *propCxx14 = + this->GetDefinition("CMAKE_CXX14_COMPILE_FEATURES")) + { + std::vector<std::string> props; + cmSystemTools::ExpandListArgument(propCxx14, props); + needCxx14 = std::find(props.begin(), props.end(), feature) != props.end(); + } } //---------------------------------------------------------------------------- @@ -5277,8 +5287,9 @@ AddRequiredTargetCxxFeature(cmTarget *target, { bool needCxx98 = false; bool needCxx11 = false; + bool needCxx14 = false; - this->CheckNeededCxxLanguage(feature, needCxx98, needCxx11); + this->CheckNeededCxxLanguage(feature, needCxx98, needCxx11, needCxx14); const char *existingCxxStandard = target->GetProperty("CXX_STANDARD"); if (existingCxxStandard) @@ -5301,8 +5312,16 @@ AddRequiredTargetCxxFeature(cmTarget *target, bool setCxx98 = needCxx98 && !existingCxxStandard; bool setCxx11 = needCxx11 && !existingCxxStandard; + bool setCxx14 = needCxx14 && !existingCxxStandard; - if (needCxx11 && existingCxxStandard && existingCxxIt < + if (needCxx14 && existingCxxStandard && existingCxxIt < + std::find_if(cmArrayBegin(CXX_STANDARDS), + cmArrayEnd(CXX_STANDARDS), + cmStrCmp("14"))) + { + setCxx14 = true; + } + else if (needCxx11 && existingCxxStandard && existingCxxIt < std::find_if(cmArrayBegin(CXX_STANDARDS), cmArrayEnd(CXX_STANDARDS), cmStrCmp("11"))) @@ -5317,7 +5336,11 @@ AddRequiredTargetCxxFeature(cmTarget *target, setCxx98 = true; } - if (setCxx11) + if (setCxx14) + { + target->SetProperty("CXX_STANDARD", "14"); + } + else if (setCxx11) { target->SetProperty("CXX_STANDARD", "11"); } diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 9a4b9c7..e3b83af 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -1121,7 +1121,7 @@ private: void CheckNeededCLanguage(const std::string& feature, bool& needC90, bool& needC99, bool& needC11) const; void CheckNeededCxxLanguage(const std::string& feature, bool& needCxx98, - bool& needCxx11) const; + bool& needCxx11, bool& needCxx14) const; bool HaveCFeatureAvailable(cmTarget const* target, const std::string& feature) const; diff --git a/Source/cmake.h b/Source/cmake.h index 3db77e6..329b439 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -477,19 +477,25 @@ private: F(c_variadic_macros) #define FOR_EACH_CXX_FEATURE(F) \ + F(cxx_aggregate_default_initializers) \ F(cxx_alias_templates) \ F(cxx_alignas) \ F(cxx_alignof) \ F(cxx_attributes) \ + F(cxx_attribute_deprecated) \ F(cxx_auto_type) \ + F(cxx_binary_literals) \ F(cxx_constexpr) \ + F(cxx_contextual_conversions) \ F(cxx_decltype) \ + F(cxx_decltype_auto) \ F(cxx_decltype_incomplete_return_types) \ F(cxx_default_function_template_args) \ F(cxx_defaulted_functions) \ F(cxx_defaulted_move_initializers) \ F(cxx_delegating_constructors) \ F(cxx_deleted_functions) \ + F(cxx_digit_separators) \ F(cxx_enum_forward_declarations) \ F(cxx_explicit_conversions) \ F(cxx_extended_friend_declarations) \ @@ -497,9 +503,11 @@ private: F(cxx_final) \ F(cxx_func_identifier) \ F(cxx_generalized_initializers) \ + F(cxx_generic_lambdas) \ F(cxx_inheriting_constructors) \ F(cxx_inline_namespaces) \ F(cxx_lambdas) \ + F(cxx_lambda_init_captures) \ F(cxx_local_type_template_args) \ F(cxx_long_long_type) \ F(cxx_noexcept) \ @@ -509,6 +517,8 @@ private: F(cxx_range_for) \ F(cxx_raw_string_literals) \ F(cxx_reference_qualified_functions) \ + F(cxx_relaxed_constexpr) \ + F(cxx_return_type_deduction) \ F(cxx_right_angle_brackets) \ F(cxx_rvalue_references) \ F(cxx_sizeof_member) \ @@ -521,6 +531,7 @@ private: F(cxx_uniform_initialization) \ F(cxx_unrestricted_unions) \ F(cxx_user_literals) \ + F(cxx_variable_templates) \ F(cxx_variadic_macros) \ F(cxx_variadic_templates) |