summaryrefslogtreecommitdiffstats
path: root/Source/cmMakefile.cxx
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2014-05-05 22:21:14 (GMT)
committerStephen Kelly <steveire@gmail.com>2014-05-22 16:01:23 (GMT)
commitdd043c3f21fbfab17d7f400bd2bc9f927215b18e (patch)
tree73f942d1294819f457309e1ccb507a057901a180 /Source/cmMakefile.cxx
parent3ea9bde8450a28b58730230e9e73e4b8d439f701 (diff)
downloadCMake-dd043c3f21fbfab17d7f400bd2bc9f927215b18e.zip
CMake-dd043c3f21fbfab17d7f400bd2bc9f927215b18e.tar.gz
CMake-dd043c3f21fbfab17d7f400bd2bc9f927215b18e.tar.bz2
Features: Add support for C++14 features.
Record the features implemented by GNU 4.9 and Clang 3.4.
Diffstat (limited to 'Source/cmMakefile.cxx')
-rw-r--r--Source/cmMakefile.cxx33
1 files changed, 28 insertions, 5 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 9f33b92..9e72fb8 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -4992,6 +4992,7 @@ static const char * const C_STANDARDS[] = {
static const char * const CXX_STANDARDS[] = {
"98"
, "11"
+ , "14"
};
//----------------------------------------------------------------------------
@@ -5214,7 +5215,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)
@@ -5257,7 +5259,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"))
@@ -5273,6 +5276,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();
+ }
}
//----------------------------------------------------------------------------
@@ -5282,8 +5292,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)
@@ -5306,8 +5317,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")))
@@ -5322,7 +5341,11 @@ AddRequiredTargetCxxFeature(cmTarget *target,
setCxx98 = true;
}
- if (setCxx11)
+ if (setCxx14)
+ {
+ target->SetProperty("CXX_STANDARD", "14");
+ }
+ else if (setCxx11)
{
target->SetProperty("CXX_STANDARD", "11");
}