cmTarget: Split storage of include directories from genexes.
This commit is contained in:
parent
7568199b4d
commit
1f54bc1cf3
@ -1549,6 +1549,7 @@ void cmGlobalGenerator::CreateGeneratorTargets(TargetTypes targetTypes,
|
|||||||
ti != targets.end(); ++ti)
|
ti != targets.end(); ++ti)
|
||||||
{
|
{
|
||||||
cmTarget* t = &ti->second;
|
cmTarget* t = &ti->second;
|
||||||
|
t->Compute();
|
||||||
cmGeneratorTarget* gt = new cmGeneratorTarget(t, lg);
|
cmGeneratorTarget* gt = new cmGeneratorTarget(t, lg);
|
||||||
this->GeneratorTargets[t] = gt;
|
this->GeneratorTargets[t] = gt;
|
||||||
generatorTargets[t] = gt;
|
generatorTargets[t] = gt;
|
||||||
|
@ -254,6 +254,7 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget()
|
|||||||
mf->AddUtilityCommand(CMAKE_CHECK_BUILD_SYSTEM_TARGET, false,
|
mf->AddUtilityCommand(CMAKE_CHECK_BUILD_SYSTEM_TARGET, false,
|
||||||
no_working_directory, no_depends,
|
no_working_directory, no_depends,
|
||||||
noCommandLines);
|
noCommandLines);
|
||||||
|
tgt->Compute();
|
||||||
cmGeneratorTarget* gt = new cmGeneratorTarget(tgt, lg);
|
cmGeneratorTarget* gt = new cmGeneratorTarget(tgt, lg);
|
||||||
mf->AddGeneratorTarget(tgt, gt);
|
mf->AddGeneratorTarget(tgt, gt);
|
||||||
|
|
||||||
|
@ -90,6 +90,7 @@ bool cmGlobalVisualStudioGenerator::Compute()
|
|||||||
AddUtilityCommand("ALL_BUILD", true, no_working_dir,
|
AddUtilityCommand("ALL_BUILD", true, no_working_dir,
|
||||||
no_depends, no_commands, false,
|
no_depends, no_commands, false,
|
||||||
"Build all projects");
|
"Build all projects");
|
||||||
|
allBuild->Compute();
|
||||||
cmGeneratorTarget* gt = new cmGeneratorTarget(allBuild, gen[0]);
|
cmGeneratorTarget* gt = new cmGeneratorTarget(allBuild, gen[0]);
|
||||||
allBuild->GetMakefile()->AddGeneratorTarget(allBuild, gt);
|
allBuild->GetMakefile()->AddGeneratorTarget(allBuild, gt);
|
||||||
|
|
||||||
|
@ -463,6 +463,7 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root,
|
|||||||
cmTarget* allbuild = mf->AddUtilityCommand("ALL_BUILD", true, no_depends,
|
cmTarget* allbuild = mf->AddUtilityCommand("ALL_BUILD", true, no_depends,
|
||||||
no_working_directory,
|
no_working_directory,
|
||||||
"echo", "Build all projects");
|
"echo", "Build all projects");
|
||||||
|
allbuild->Compute();
|
||||||
cmGeneratorTarget* allBuildGt = new cmGeneratorTarget(allbuild, root);
|
cmGeneratorTarget* allBuildGt = new cmGeneratorTarget(allbuild, root);
|
||||||
mf->AddGeneratorTarget(allbuild, allBuildGt);
|
mf->AddGeneratorTarget(allbuild, allBuildGt);
|
||||||
|
|
||||||
@ -497,6 +498,7 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root,
|
|||||||
true, no_depends,
|
true, no_depends,
|
||||||
no_working_directory,
|
no_working_directory,
|
||||||
"make", "-f", file.c_str());
|
"make", "-f", file.c_str());
|
||||||
|
check->Compute();
|
||||||
cmGeneratorTarget* checkGt = new cmGeneratorTarget(check, root);
|
cmGeneratorTarget* checkGt = new cmGeneratorTarget(check, root);
|
||||||
mf->AddGeneratorTarget(check, checkGt);
|
mf->AddGeneratorTarget(check, checkGt);
|
||||||
}
|
}
|
||||||
|
@ -475,6 +475,8 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmLocalGenerator* lg,
|
|||||||
/*byproducts=*/rcc_output, depends,
|
/*byproducts=*/rcc_output, depends,
|
||||||
commandLines, false, autogenComment.c_str());
|
commandLines, false, autogenComment.c_str());
|
||||||
|
|
||||||
|
autogenTarget->Compute();
|
||||||
|
|
||||||
cmGeneratorTarget* gt = new cmGeneratorTarget(autogenTarget, lg);
|
cmGeneratorTarget* gt = new cmGeneratorTarget(autogenTarget, lg);
|
||||||
makefile->AddGeneratorTarget(autogenTarget, gt);
|
makefile->AddGeneratorTarget(autogenTarget, gt);
|
||||||
|
|
||||||
|
@ -168,7 +168,9 @@ public:
|
|||||||
const cmsys::auto_ptr<cmCompiledGeneratorExpression> ge;
|
const cmsys::auto_ptr<cmCompiledGeneratorExpression> ge;
|
||||||
cmLinkImplItem const& LinkImplItem;
|
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*> CompileOptionsEntries;
|
||||||
std::vector<TargetPropertyEntry*> CompileFeaturesEntries;
|
std::vector<TargetPropertyEntry*> CompileFeaturesEntries;
|
||||||
std::vector<TargetPropertyEntry*> CompileDefinitionsEntries;
|
std::vector<TargetPropertyEntry*> CompileDefinitionsEntries;
|
||||||
@ -366,13 +368,13 @@ void cmTarget::SetMakefile(cmMakefile* mf)
|
|||||||
const cmBacktraceRange parentIncludesBts =
|
const cmBacktraceRange parentIncludesBts =
|
||||||
this->Makefile->GetIncludeDirectoriesBacktraces();
|
this->Makefile->GetIncludeDirectoriesBacktraces();
|
||||||
|
|
||||||
cmBacktraceRange::const_iterator btIt = parentIncludesBts.begin();
|
this->Internal->IncludeDirectoriesEntries.insert(
|
||||||
for (cmStringRange::const_iterator it
|
this->Internal->IncludeDirectoriesEntries.end(),
|
||||||
= parentIncludes.begin();
|
parentIncludes.begin(), parentIncludes.end());
|
||||||
it != parentIncludes.end(); ++it, ++btIt)
|
this->Internal->IncludeDirectoriesBacktraces.insert(
|
||||||
{
|
this->Internal->IncludeDirectoriesBacktraces.end(),
|
||||||
this->InsertInclude(*it, *btIt);
|
parentIncludesBts.begin(), parentIncludesBts.end());
|
||||||
}
|
|
||||||
const std::set<std::string> parentSystemIncludes =
|
const std::set<std::string> parentSystemIncludes =
|
||||||
this->Makefile->GetSystemIncludeDirectories();
|
this->Makefile->GetSystemIncludeDirectories();
|
||||||
|
|
||||||
@ -384,7 +386,7 @@ void cmTarget::SetMakefile(cmMakefile* mf)
|
|||||||
const cmBacktraceRange parentOptionsBts =
|
const cmBacktraceRange parentOptionsBts =
|
||||||
this->Makefile->GetCompileOptionsBacktraces();
|
this->Makefile->GetCompileOptionsBacktraces();
|
||||||
|
|
||||||
btIt = parentOptionsBts.begin();
|
cmBacktraceRange::const_iterator btIt = parentOptionsBts.begin();
|
||||||
for (cmStringRange::const_iterator it
|
for (cmStringRange::const_iterator it
|
||||||
= parentOptions.begin();
|
= parentOptions.begin();
|
||||||
it != parentOptions.end(); ++it, ++btIt)
|
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)
|
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")
|
else if(prop == "INCLUDE_DIRECTORIES")
|
||||||
{
|
{
|
||||||
|
this->Internal->IncludeDirectoriesEntries.clear();
|
||||||
|
this->Internal->IncludeDirectoriesBacktraces.clear();
|
||||||
|
this->Internal->IncludeDirectoriesEntries.push_back(value);
|
||||||
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
|
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
|
||||||
cmGeneratorExpression ge(lfbt);
|
this->Internal->IncludeDirectoriesBacktraces.push_back(lfbt);
|
||||||
deleteAndClear(this->Internal->IncludeDirectoriesEntries);
|
|
||||||
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(value);
|
|
||||||
this->Internal->IncludeDirectoriesEntries.push_back(
|
|
||||||
new cmTargetInternals::TargetPropertyEntry(cge));
|
|
||||||
}
|
}
|
||||||
else if(prop == "COMPILE_OPTIONS")
|
else if(prop == "COMPILE_OPTIONS")
|
||||||
{
|
{
|
||||||
@ -1764,10 +1788,9 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value,
|
|||||||
}
|
}
|
||||||
else if(prop == "INCLUDE_DIRECTORIES")
|
else if(prop == "INCLUDE_DIRECTORIES")
|
||||||
{
|
{
|
||||||
|
this->Internal->IncludeDirectoriesEntries.push_back(value);
|
||||||
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
|
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
|
||||||
cmGeneratorExpression ge(lfbt);
|
this->Internal->IncludeDirectoriesBacktraces.push_back(lfbt);
|
||||||
this->Internal->IncludeDirectoriesEntries.push_back(
|
|
||||||
new cmTargetInternals::TargetPropertyEntry(ge.Parse(value)));
|
|
||||||
}
|
}
|
||||||
else if(prop == "COMPILE_OPTIONS")
|
else if(prop == "COMPILE_OPTIONS")
|
||||||
{
|
{
|
||||||
@ -1887,14 +1910,16 @@ void cmTarget::InsertInclude(std::string const& entry,
|
|||||||
cmListFileBacktrace const& bt,
|
cmListFileBacktrace const& bt,
|
||||||
bool before)
|
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
|
std::vector<cmListFileBacktrace>::iterator btPosition =
|
||||||
= before ? this->Internal->IncludeDirectoriesEntries.begin()
|
before ? this->Internal->IncludeDirectoriesBacktraces.begin()
|
||||||
: this->Internal->IncludeDirectoriesEntries.end();
|
: this->Internal->IncludeDirectoriesBacktraces.end();
|
||||||
|
|
||||||
this->Internal->IncludeDirectoriesEntries.insert(position,
|
this->Internal->IncludeDirectoriesEntries.insert(position, entry);
|
||||||
new cmTargetInternals::TargetPropertyEntry(ge.Parse(entry)));
|
this->Internal->IncludeDirectoriesBacktraces.insert(btPosition, bt);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@ -2083,7 +2108,7 @@ cmTarget::GetIncludeDirectories(const std::string& config,
|
|||||||
}
|
}
|
||||||
|
|
||||||
processIncludeDirectories(this,
|
processIncludeDirectories(this,
|
||||||
this->Internal->IncludeDirectoriesEntries,
|
this->Internal->IncludeDirectoriesItems,
|
||||||
includes,
|
includes,
|
||||||
uniqueIncludes,
|
uniqueIncludes,
|
||||||
&dagChecker,
|
&dagChecker,
|
||||||
@ -2899,7 +2924,7 @@ const char *cmTarget::GetProperty(const std::string& prop,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static std::string output;
|
static std::string output;
|
||||||
MakePropertyList(output, this->Internal->IncludeDirectoriesEntries);
|
output = cmJoin(this->Internal->IncludeDirectoriesEntries, ";");
|
||||||
return output.c_str();
|
return output.c_str();
|
||||||
}
|
}
|
||||||
else if(prop == propCOMPILE_FEATURES)
|
else if(prop == propCOMPILE_FEATURES)
|
||||||
@ -4805,7 +4830,7 @@ cmTargetInternalPointer
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
cmTargetInternalPointer::~cmTargetInternalPointer()
|
cmTargetInternalPointer::~cmTargetInternalPointer()
|
||||||
{
|
{
|
||||||
cmDeleteAll(this->Pointer->IncludeDirectoriesEntries);
|
cmDeleteAll(this->Pointer->IncludeDirectoriesItems);
|
||||||
cmDeleteAll(this->Pointer->CompileOptionsEntries);
|
cmDeleteAll(this->Pointer->CompileOptionsEntries);
|
||||||
cmDeleteAll(this->Pointer->CompileFeaturesEntries);
|
cmDeleteAll(this->Pointer->CompileFeaturesEntries);
|
||||||
cmDeleteAll(this->Pointer->CompileDefinitionsEntries);
|
cmDeleteAll(this->Pointer->CompileDefinitionsEntries);
|
||||||
|
@ -132,6 +132,8 @@ public:
|
|||||||
void AddPostBuildCommand(cmCustomCommand const &cmd)
|
void AddPostBuildCommand(cmCustomCommand const &cmd)
|
||||||
{this->PostBuildCommands.push_back(cmd);}
|
{this->PostBuildCommands.push_back(cmd);}
|
||||||
|
|
||||||
|
void Compute();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the list of the source files used by this target
|
* Get the list of the source files used by this target
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user