summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/cmGeneratorTarget.cxx13
-rw-r--r--Source/cmGeneratorTarget.h2
-rw-r--r--Source/cmGlobalGenerator.cxx12
-rw-r--r--Source/cmLocalGenerator.cxx33
-rw-r--r--Source/cmLocalGenerator.h2
5 files changed, 54 insertions, 8 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index a0f677b..3f50e32 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -2919,6 +2919,19 @@ void cmGeneratorTarget::ComputeTargetManifest(const std::string& config) const
}
}
+bool cmGeneratorTarget::ComputeCompileFeatures(std::string const& config) const
+{
+ std::vector<std::string> features;
+ this->GetCompileFeatures(features, config);
+ for (std::vector<std::string>::const_iterator it = features.begin();
+ it != features.end(); ++it) {
+ if (!this->Makefile->AddRequiredTargetFeature(this->Target, *it)) {
+ return false;
+ }
+ }
+ return true;
+}
+
std::string cmGeneratorTarget::GetImportedLibName(
std::string const& config) const
{
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 13b6b73..134b7c7 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -412,6 +412,8 @@ public:
/** Add the target output files to the global generator manifest. */
void ComputeTargetManifest(const std::string& config) const;
+ bool ComputeCompileFeatures(std::string const& config) const;
+
/**
* Trace through the source files in this target and add al source files
* that they depend on, used by all generators
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 50ad1a8..f3eb249 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1272,6 +1272,18 @@ bool cmGlobalGenerator::Compute()
this->LocalGenerators[i]->AddHelperCommands();
}
+ // Finalize the set of compile features for each target.
+ // FIXME: This turns into calls to cmMakefile::AddRequiredTargetFeature
+ // which actually modifies the <lang>_STANDARD target property
+ // on the original cmTarget instance. It accumulates features
+ // across all configurations. Some refactoring is needed to
+ // compute a per-config resulta purely during generation.
+ for (i = 0; i < this->LocalGenerators.size(); ++i) {
+ if (!this->LocalGenerators[i]->ComputeTargetCompileFeatures()) {
+ return false;
+ }
+ }
+
#ifdef CMAKE_BUILD_WITH_CMAKE
for (std::vector<cmGeneratorTarget const*>::iterator it =
autogenTargets.begin();
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 33e32d1..6c8f132 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -558,6 +558,31 @@ void cmLocalGenerator::ComputeTargetManifest()
}
}
+bool cmLocalGenerator::ComputeTargetCompileFeatures()
+{
+ // Collect the set of configuration types.
+ std::vector<std::string> configNames;
+ this->Makefile->GetConfigurations(configNames);
+ if (configNames.empty()) {
+ configNames.push_back("");
+ }
+
+ // Process compile features of all targets.
+ std::vector<cmGeneratorTarget*> targets = this->GetGeneratorTargets();
+ for (std::vector<cmGeneratorTarget*>::iterator t = targets.begin();
+ t != targets.end(); ++t) {
+ cmGeneratorTarget* target = *t;
+ for (std::vector<std::string>::iterator ci = configNames.begin();
+ ci != configNames.end(); ++ci) {
+ if (!target->ComputeCompileFeatures(*ci)) {
+ return false;
+ }
+ }
+ }
+
+ return true;
+}
+
bool cmLocalGenerator::IsRootMakefile() const
{
return !this->StateSnapshot.GetBuildsystemDirectoryParent().IsValid();
@@ -742,14 +767,6 @@ void cmLocalGenerator::AddCompileOptions(std::string& flags,
this->AppendFlagEscape(flags, *i);
}
}
- std::vector<std::string> features;
- target->GetCompileFeatures(features, config);
- for (std::vector<std::string>::const_iterator it = features.begin();
- it != features.end(); ++it) {
- if (!this->Makefile->AddRequiredTargetFeature(target->Target, *it)) {
- return;
- }
- }
for (std::map<std::string, std::string>::const_iterator it =
target->GetMaxLanguageStandards().begin();
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 1a238a8..7d591ac 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -70,6 +70,8 @@ public:
*/
void ComputeTargetManifest();
+ bool ComputeTargetCompileFeatures();
+
bool IsRootMakefile() const;
///! Get the makefile for this generator