summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2013-10-22 13:05:49 (GMT)
committerStephen Kelly <steveire@gmail.com>2014-04-07 16:11:18 (GMT)
commitbaff44345cff8e635766e020d316da514616c16e (patch)
tree5d5052e16ad545de670d3ec116a378297b2f482c /Source
parentf97bf4370c283432c4e14fe54ed481d5d9b7ceef (diff)
downloadCMake-baff44345cff8e635766e020d316da514616c16e.zip
CMake-baff44345cff8e635766e020d316da514616c16e.tar.gz
CMake-baff44345cff8e635766e020d316da514616c16e.tar.bz2
cmTarget: Allow populating COMPILE_FEATURES using generator expressions.
Delay validation of the content as a feature if it contains a generator expression. It will be checked again at generate-time after evaluation.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmLocalGenerator.cxx15
-rw-r--r--Source/cmMakefile.cxx5
-rw-r--r--Source/cmTarget.cxx16
-rw-r--r--Source/cmTarget.h1
4 files changed, 28 insertions, 9 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 0f8e7dc..f581806 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1459,17 +1459,14 @@ void cmLocalGenerator::AddCompileOptions(
this->AppendFlagEscape(flags, *i);
}
}
- if (const char* featureProp = target->GetProperty("COMPILE_FEATURES"))
+ std::vector<std::string> features;
+ target->GetCompileFeatures(features);
+ for(std::vector<std::string>::const_iterator it = features.begin();
+ it != features.end(); ++it)
{
- std::vector<std::string> features;
- cmSystemTools::ExpandListArgument(featureProp, features);
- for(std::vector<std::string>::const_iterator it = features.begin();
- it != features.end(); ++it)
+ if (!this->Makefile->AddRequiredTargetFeature(target, *it))
{
- if (!this->Makefile->AddRequiredTargetFeature(target, *it))
- {
- return;
- }
+ return;
}
}
this->AddCompilerRequirementFlag(flags, target, lang);
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 0b3c43e..5004a08 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -4521,6 +4521,11 @@ bool cmMakefile::
AddRequiredTargetFeature(cmTarget *target, const std::string& feature,
std::string *error) const
{
+ if (cmGeneratorExpression::Find(feature) != std::string::npos)
+ {
+ target->AppendProperty("COMPILE_FEATURES", feature.c_str());
+ return true;
+ }
bool isCxxFeature = std::find_if(cmArrayBegin(CXX_FEATURES) + 1,
cmArrayEnd(CXX_FEATURES), cmStrCmp(feature))
!= cmArrayEnd(CXX_FEATURES);
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 6f53009..09e3339 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -2617,6 +2617,22 @@ void cmTarget::GetCompileDefinitions(std::vector<std::string> &list,
}
//----------------------------------------------------------------------------
+void cmTarget::GetCompileFeatures(std::vector<std::string> &features) const
+{
+ assert(this->GetType() != INTERFACE_LIBRARY);
+ for(std::vector<cmTargetInternals::TargetPropertyEntry*>::const_iterator
+ si = this->Internal->CompileFeaturesEntries.begin();
+ si != this->Internal->CompileFeaturesEntries.end(); ++si)
+ {
+ cmSystemTools::ExpandListArgument((*si)->ge->Evaluate(this->Makefile,
+ "",
+ false,
+ this),
+ features);
+ }
+}
+
+//----------------------------------------------------------------------------
void cmTarget::MaybeInvalidatePropertyCache(const std::string& prop)
{
// Wipe out maps caching information affected by this property.
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index da9d0a1..fe3ea2b 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -545,6 +545,7 @@ public:
const std::string& config) const;
void GetAutoUicOptions(std::vector<std::string> &result,
const std::string& config) const;
+ void GetCompileFeatures(std::vector<std::string> &features) const;
bool IsNullImpliedByLinkLibraries(const std::string &p) const;
bool IsLinkInterfaceDependentBoolProperty(const std::string &p,