summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2015-08-04 18:25:02 (GMT)
committerStephen Kelly <steveire@gmail.com>2015-08-07 15:06:15 (GMT)
commit1f54bc1cf35707a5f1410ff4c6632d7cba351c40 (patch)
tree8940b8c8bb62a4d1849c441515764be4d4fbb6a8
parent7568199b4de18ed56ad8ef735c145c4a44327355 (diff)
downloadCMake-1f54bc1cf35707a5f1410ff4c6632d7cba351c40.zip
CMake-1f54bc1cf35707a5f1410ff4c6632d7cba351c40.tar.gz
CMake-1f54bc1cf35707a5f1410ff4c6632d7cba351c40.tar.bz2
cmTarget: Split storage of include directories from genexes.
-rw-r--r--Source/cmGlobalGenerator.cxx1
-rw-r--r--Source/cmGlobalVisualStudio8Generator.cxx1
-rw-r--r--Source/cmGlobalVisualStudioGenerator.cxx1
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx2
-rw-r--r--Source/cmQtAutoGenerators.cxx2
-rw-r--r--Source/cmTarget.cxx77
-rw-r--r--Source/cmTarget.h2
7 files changed, 60 insertions, 26 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 3c818ff..50e2cd9 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1549,6 +1549,7 @@ void cmGlobalGenerator::CreateGeneratorTargets(TargetTypes targetTypes,
ti != targets.end(); ++ti)
{
cmTarget* t = &ti->second;
+ t->Compute();
cmGeneratorTarget* gt = new cmGeneratorTarget(t, lg);
this->GeneratorTargets[t] = gt;
generatorTargets[t] = gt;
diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx
index d5a5585..51dcab0 100644
--- a/Source/cmGlobalVisualStudio8Generator.cxx
+++ b/Source/cmGlobalVisualStudio8Generator.cxx
@@ -254,6 +254,7 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget()
mf->AddUtilityCommand(CMAKE_CHECK_BUILD_SYSTEM_TARGET, false,
no_working_directory, no_depends,
noCommandLines);
+ tgt->Compute();
cmGeneratorTarget* gt = new cmGeneratorTarget(tgt, lg);
mf->AddGeneratorTarget(tgt, gt);
diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx
index 2f9d79a..b69fc65 100644
--- a/Source/cmGlobalVisualStudioGenerator.cxx
+++ b/Source/cmGlobalVisualStudioGenerator.cxx
@@ -90,6 +90,7 @@ bool cmGlobalVisualStudioGenerator::Compute()
AddUtilityCommand("ALL_BUILD", true, no_working_dir,
no_depends, no_commands, false,
"Build all projects");
+ allBuild->Compute();
cmGeneratorTarget* gt = new cmGeneratorTarget(allBuild, gen[0]);
allBuild->GetMakefile()->AddGeneratorTarget(allBuild, gt);
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 5006828..39933cb 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -463,6 +463,7 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root,
cmTarget* allbuild = mf->AddUtilityCommand("ALL_BUILD", true, no_depends,
no_working_directory,
"echo", "Build all projects");
+ allbuild->Compute();
cmGeneratorTarget* allBuildGt = new cmGeneratorTarget(allbuild, root);
mf->AddGeneratorTarget(allbuild, allBuildGt);
@@ -497,6 +498,7 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root,
true, no_depends,
no_working_directory,
"make", "-f", file.c_str());
+ check->Compute();
cmGeneratorTarget* checkGt = new cmGeneratorTarget(check, root);
mf->AddGeneratorTarget(check, checkGt);
}
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index f1ba2f4..ce806ba 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -475,6 +475,8 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmLocalGenerator* lg,
/*byproducts=*/rcc_output, depends,
commandLines, false, autogenComment.c_str());
+ autogenTarget->Compute();
+
cmGeneratorTarget* gt = new cmGeneratorTarget(autogenTarget, lg);
makefile->AddGeneratorTarget(autogenTarget, gt);
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 7b25819..1eb8e6a 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -168,7 +168,9 @@ public:
const cmsys::auto_ptr<cmCompiledGeneratorExpression> ge;
cmLinkImplItem const& LinkImplItem;
};
- std::vector<TargetPropertyEntry*> IncludeDirectoriesEntries;
+ std::vector<std::string> IncludeDirectoriesEntries;
+ std::vector<cmListFileBacktrace> IncludeDirectoriesBacktraces;
+ std::vector<TargetPropertyEntry*> IncludeDirectoriesItems;
std::vector<TargetPropertyEntry*> CompileOptionsEntries;
std::vector<TargetPropertyEntry*> CompileFeaturesEntries;
std::vector<TargetPropertyEntry*> CompileDefinitionsEntries;
@@ -366,13 +368,13 @@ void cmTarget::SetMakefile(cmMakefile* mf)
const cmBacktraceRange parentIncludesBts =
this->Makefile->GetIncludeDirectoriesBacktraces();
- cmBacktraceRange::const_iterator btIt = parentIncludesBts.begin();
- for (cmStringRange::const_iterator it
- = parentIncludes.begin();
- it != parentIncludes.end(); ++it, ++btIt)
- {
- this->InsertInclude(*it, *btIt);
- }
+ this->Internal->IncludeDirectoriesEntries.insert(
+ this->Internal->IncludeDirectoriesEntries.end(),
+ parentIncludes.begin(), parentIncludes.end());
+ this->Internal->IncludeDirectoriesBacktraces.insert(
+ this->Internal->IncludeDirectoriesBacktraces.end(),
+ parentIncludesBts.begin(), parentIncludesBts.end());
+
const std::set<std::string> parentSystemIncludes =
this->Makefile->GetSystemIncludeDirectories();
@@ -384,7 +386,7 @@ void cmTarget::SetMakefile(cmMakefile* mf)
const cmBacktraceRange parentOptionsBts =
this->Makefile->GetCompileOptionsBacktraces();
- btIt = parentOptionsBts.begin();
+ cmBacktraceRange::const_iterator btIt = parentOptionsBts.begin();
for (cmStringRange::const_iterator it
= parentOptions.begin();
it != parentOptions.end(); ++it, ++btIt)
@@ -438,6 +440,29 @@ void cmTarget::SetMakefile(cmMakefile* mf)
}
}
+void CreatePropertyGeneratorExpressions(
+ std::vector<std::string> const& entries,
+ std::vector<cmListFileBacktrace> const& backtraces,
+ std::vector<cmTargetInternals::TargetPropertyEntry*>& items)
+{
+ std::vector<cmListFileBacktrace>::const_iterator btIt = backtraces.begin();
+ for (std::vector<std::string>::const_iterator it = entries.begin();
+ it != entries.end(); ++it, ++btIt)
+ {
+ cmGeneratorExpression ge(*btIt);
+ cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(*it);
+ items.push_back(new cmTargetInternals::TargetPropertyEntry(cge));
+ }
+}
+
+void cmTarget::Compute()
+{
+ CreatePropertyGeneratorExpressions(
+ this->Internal->IncludeDirectoriesEntries,
+ this->Internal->IncludeDirectoriesBacktraces,
+ this->Internal->IncludeDirectoriesItems);
+}
+
//----------------------------------------------------------------------------
void cmTarget::AddUtility(const std::string& u, cmMakefile *makefile)
{
@@ -1666,12 +1691,11 @@ void cmTarget::SetProperty(const std::string& prop, const char* value)
}
else if(prop == "INCLUDE_DIRECTORIES")
{
+ this->Internal->IncludeDirectoriesEntries.clear();
+ this->Internal->IncludeDirectoriesBacktraces.clear();
+ this->Internal->IncludeDirectoriesEntries.push_back(value);
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
- cmGeneratorExpression ge(lfbt);
- deleteAndClear(this->Internal->IncludeDirectoriesEntries);
- cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(value);
- this->Internal->IncludeDirectoriesEntries.push_back(
- new cmTargetInternals::TargetPropertyEntry(cge));
+ this->Internal->IncludeDirectoriesBacktraces.push_back(lfbt);
}
else if(prop == "COMPILE_OPTIONS")
{
@@ -1764,10 +1788,9 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value,
}
else if(prop == "INCLUDE_DIRECTORIES")
{
+ this->Internal->IncludeDirectoriesEntries.push_back(value);
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
- cmGeneratorExpression ge(lfbt);
- this->Internal->IncludeDirectoriesEntries.push_back(
- new cmTargetInternals::TargetPropertyEntry(ge.Parse(value)));
+ this->Internal->IncludeDirectoriesBacktraces.push_back(lfbt);
}
else if(prop == "COMPILE_OPTIONS")
{
@@ -1887,14 +1910,16 @@ void cmTarget::InsertInclude(std::string const& entry,
cmListFileBacktrace const& bt,
bool before)
{
- cmGeneratorExpression ge(bt);
+ std::vector<std::string>::iterator position =
+ before ? this->Internal->IncludeDirectoriesEntries.begin()
+ : this->Internal->IncludeDirectoriesEntries.end();
- std::vector<cmTargetInternals::TargetPropertyEntry*>::iterator position
- = before ? this->Internal->IncludeDirectoriesEntries.begin()
- : this->Internal->IncludeDirectoriesEntries.end();
+ std::vector<cmListFileBacktrace>::iterator btPosition =
+ before ? this->Internal->IncludeDirectoriesBacktraces.begin()
+ : this->Internal->IncludeDirectoriesBacktraces.end();
- this->Internal->IncludeDirectoriesEntries.insert(position,
- new cmTargetInternals::TargetPropertyEntry(ge.Parse(entry)));
+ this->Internal->IncludeDirectoriesEntries.insert(position, entry);
+ this->Internal->IncludeDirectoriesBacktraces.insert(btPosition, bt);
}
//----------------------------------------------------------------------------
@@ -2083,7 +2108,7 @@ cmTarget::GetIncludeDirectories(const std::string& config,
}
processIncludeDirectories(this,
- this->Internal->IncludeDirectoriesEntries,
+ this->Internal->IncludeDirectoriesItems,
includes,
uniqueIncludes,
&dagChecker,
@@ -2899,7 +2924,7 @@ const char *cmTarget::GetProperty(const std::string& prop,
}
static std::string output;
- MakePropertyList(output, this->Internal->IncludeDirectoriesEntries);
+ output = cmJoin(this->Internal->IncludeDirectoriesEntries, ";");
return output.c_str();
}
else if(prop == propCOMPILE_FEATURES)
@@ -4805,7 +4830,7 @@ cmTargetInternalPointer
//----------------------------------------------------------------------------
cmTargetInternalPointer::~cmTargetInternalPointer()
{
- cmDeleteAll(this->Pointer->IncludeDirectoriesEntries);
+ cmDeleteAll(this->Pointer->IncludeDirectoriesItems);
cmDeleteAll(this->Pointer->CompileOptionsEntries);
cmDeleteAll(this->Pointer->CompileFeaturesEntries);
cmDeleteAll(this->Pointer->CompileDefinitionsEntries);
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index c5918ba..490aaa3 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -132,6 +132,8 @@ public:
void AddPostBuildCommand(cmCustomCommand const &cmd)
{this->PostBuildCommands.push_back(cmd);}
+ void Compute();
+
/**
* Get the list of the source files used by this target
*/