summaryrefslogtreecommitdiffstats
path: root/Source/cmMakefile.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-05-29 13:58:37 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2014-05-29 13:58:37 (GMT)
commit1468e986e1874f7c011e74885e4df2fbab65b396 (patch)
tree333b77c1a92d5d86e803f03019ecd582362eb003 /Source/cmMakefile.cxx
parent9e11fcdc761f441de638b321874aea4d97a72676 (diff)
parentdd043c3f21fbfab17d7f400bd2bc9f927215b18e (diff)
downloadCMake-1468e986e1874f7c011e74885e4df2fbab65b396.zip
CMake-1468e986e1874f7c011e74885e4df2fbab65b396.tar.gz
CMake-1468e986e1874f7c011e74885e4df2fbab65b396.tar.bz2
Merge topic 'cxx14-features'
dd043c3f Features: Add support for C++14 features.
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 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");
}