Merge topic 'use-generator-target'

29886ce7 cmTarget: Use a simpler delete algorithm.
197f4de1 cmTarget: Split storage of compile definitions from genexes.
44e071ae cmTarget: Split storage of compile features from genexes.
772ecef4 cmTarget: Split storage of compile options from genexes.
1f54bc1c cmTarget: Split storage of include directories from genexes.
7568199b cmTarget: Request only the link libraries where needed.
10040601 cmLinkImplementationLibraries: Move to namespace scope.
d9da6ee2 cmLinkItem: Split to separate file.
27252b24 cmComputeLinkInformation: Simplify generator object access.
This commit is contained in:
Brad King 2015-08-11 08:47:08 -04:00 committed by CMake Topic Stage
commit 6e5953e9a4
12 changed files with 212 additions and 167 deletions

View File

@ -288,6 +288,7 @@ set(SRCS
cmInstallDirectoryGenerator.h
cmInstallDirectoryGenerator.cxx
cmLinkedTree.h
cmLinkItem.h
cmListFileCache.cxx
cmListFileCache.h
cmListFileLexer.c

View File

@ -14,6 +14,7 @@
#include "cmComputeLinkDepends.h"
#include "cmOrderDirectories.h"
#include "cmLocalGenerator.h"
#include "cmGlobalGenerator.h"
#include "cmState.h"
#include "cmOutputConverter.h"
@ -248,7 +249,8 @@ cmComputeLinkInformation
// Store context information.
this->Target = target;
this->Makefile = this->Target->Target->GetMakefile();
this->GlobalGenerator = this->Makefile->GetGlobalGenerator();
this->GlobalGenerator =
this->Target->GetLocalGenerator()->GetGlobalGenerator();
this->CMakeInstance = this->GlobalGenerator->GetCMakeInstance();
// Check whether to recognize OpenBSD-style library versioned names.
@ -540,9 +542,7 @@ bool cmComputeLinkInformation::Compute()
i != wrongItems.end(); ++i)
{
cmTarget const* tgt = *i;
cmGeneratorTarget *gtgt = tgt->GetMakefile()
->GetGlobalGenerator()
->GetGeneratorTarget(tgt);
cmGeneratorTarget *gtgt = this->GlobalGenerator->GetGeneratorTarget(tgt);
bool implib =
(this->UseImportLibrary &&
(tgt->GetType() == cmTarget::SHARED_LIBRARY));
@ -646,9 +646,7 @@ void cmComputeLinkInformation::AddItem(std::string const& item,
if(tgt && tgt->IsLinkable())
{
cmGeneratorTarget *gtgt = tgt->GetMakefile()
->GetGlobalGenerator()
->GetGeneratorTarget(tgt);
cmGeneratorTarget *gtgt = this->GlobalGenerator->GetGeneratorTarget(tgt);
// This is a CMake target. Ask the target for its real name.
if(impexe && this->LoaderFlag)
{
@ -762,7 +760,7 @@ void cmComputeLinkInformation::AddSharedDepItem(std::string const& item,
return;
}
cmGeneratorTarget *gtgt = 0;
cmGeneratorTarget *gtgt = this->GlobalGenerator->GetGeneratorTarget(tgt);
// Get a full path to the dependent shared library.
// Add it to the runtime path computation so that the target being
@ -1812,9 +1810,7 @@ cmComputeLinkInformation::AddLibraryRuntimeInfo(std::string const& fullPath,
// Try to get the soname of the library. Only files with this name
// could possibly conflict.
cmGeneratorTarget *gtgt = target->GetMakefile()
->GetGlobalGenerator()
->GetGeneratorTarget(target);
cmGeneratorTarget *gtgt = this->GlobalGenerator->GetGeneratorTarget(target);
std::string soName = gtgt->GetSOName(this->Config);
const char* soname = soName.empty()? 0 : soName.c_str();

View File

@ -1120,7 +1120,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
}
else if(!interfacePropertyName.empty())
{
if(cmTarget::LinkImplementationLibraries const* impl =
if(cmLinkImplementationLibraries const* impl =
target->GetLinkImplementationLibraries(context->Config))
{
linkedTargetsContent =

View File

@ -1507,7 +1507,7 @@ cmGeneratorTarget::GetLinkImplementationClosure(
tgts.Done = true;
std::set<cmTarget const*> emitted;
cmTarget::LinkImplementationLibraries const* impl
cmLinkImplementationLibraries const* impl
= this->Target->GetLinkImplementationLibraries(config);
for(std::vector<cmLinkImplItem>::const_iterator

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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);
}

59
Source/cmLinkItem.h Normal file
View File

@ -0,0 +1,59 @@
/*============================================================================
CMake - Cross Platform Makefile Generator
Copyright 2004-2015 Kitware, Inc.
Distributed under the OSI-approved BSD License (the "License");
see accompanying file Copyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License for more information.
============================================================================*/
#ifndef cmLinkItem_h
#define cmLinkItem_h
#include "cmListFileCache.h"
class cmTarget;
// Basic information about each link item.
class cmLinkItem: public std::string
{
typedef std::string std_string;
public:
cmLinkItem(): std_string(), Target(0) {}
cmLinkItem(const std_string& n,
cmTarget const* t): std_string(n), Target(t) {}
cmLinkItem(cmLinkItem const& r): std_string(r), Target(r.Target) {}
cmTarget const* Target;
};
class cmLinkImplItem: public cmLinkItem
{
public:
cmLinkImplItem(): cmLinkItem(), Backtrace(), FromGenex(false) {}
cmLinkImplItem(std::string const& n,
cmTarget const* t,
cmListFileBacktrace const& bt,
bool fromGenex):
cmLinkItem(n, t), Backtrace(bt), FromGenex(fromGenex) {}
cmLinkImplItem(cmLinkImplItem const& r):
cmLinkItem(r), Backtrace(r.Backtrace), FromGenex(r.FromGenex) {}
cmListFileBacktrace Backtrace;
bool FromGenex;
};
/** The link implementation specifies the direct library
dependencies needed by the object files of the target. */
struct cmLinkImplementationLibraries
{
// Libraries linked directly in this configuration.
std::vector<cmLinkImplItem> Libraries;
// Libraries linked directly in other configurations.
// Needed only for OLD behavior of CMP0003.
std::vector<cmLinkItem> WrongConfigLibraries;
};
#endif

View File

@ -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);

View File

@ -168,10 +168,18 @@ public:
const cmsys::auto_ptr<cmCompiledGeneratorExpression> ge;
cmLinkImplItem const& LinkImplItem;
};
std::vector<TargetPropertyEntry*> IncludeDirectoriesEntries;
std::vector<TargetPropertyEntry*> CompileOptionsEntries;
std::vector<TargetPropertyEntry*> CompileFeaturesEntries;
std::vector<TargetPropertyEntry*> CompileDefinitionsEntries;
std::vector<std::string> IncludeDirectoriesEntries;
std::vector<cmListFileBacktrace> IncludeDirectoriesBacktraces;
std::vector<TargetPropertyEntry*> IncludeDirectoriesItems;
std::vector<std::string> CompileOptionsEntries;
std::vector<cmListFileBacktrace> CompileOptionsBacktraces;
std::vector<TargetPropertyEntry*> CompileOptionsItems;
std::vector<std::string> CompileFeaturesEntries;
std::vector<cmListFileBacktrace> CompileFeaturesBacktraces;
std::vector<TargetPropertyEntry*> CompileFeaturesItems;
std::vector<std::string> CompileDefinitionsEntries;
std::vector<cmListFileBacktrace> CompileDefinitionsBacktraces;
std::vector<TargetPropertyEntry*> CompileDefinitionsItems;
std::vector<TargetPropertyEntry*> SourceEntries;
std::vector<cmValueWithOrigin> LinkImplementationPropertyEntries;
@ -182,14 +190,6 @@ public:
cmLinkImplItem cmTargetInternals::TargetPropertyEntry::NoLinkImplItem;
//----------------------------------------------------------------------------
static void deleteAndClear(
std::vector<cmTargetInternals::TargetPropertyEntry*> &entries)
{
cmDeleteAll(entries);
entries.clear();
}
//----------------------------------------------------------------------------
cmTargetInternals::~cmTargetInternals()
{
@ -366,13 +366,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,13 +384,12 @@ void cmTarget::SetMakefile(cmMakefile* mf)
const cmBacktraceRange parentOptionsBts =
this->Makefile->GetCompileOptionsBacktraces();
btIt = parentOptionsBts.begin();
for (cmStringRange::const_iterator it
= parentOptions.begin();
it != parentOptions.end(); ++it, ++btIt)
{
this->InsertCompileOption(*it, *btIt);
}
this->Internal->CompileOptionsEntries.insert(
this->Internal->CompileOptionsEntries.end(),
parentOptions.begin(), parentOptions.end());
this->Internal->CompileOptionsBacktraces.insert(
this->Internal->CompileOptionsBacktraces.end(),
parentOptionsBts.begin(), parentOptionsBts.end());
}
if (this->GetType() != INTERFACE_LIBRARY && this->GetType() != UTILITY)
@ -438,6 +437,44 @@ 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);
CreatePropertyGeneratorExpressions(
this->Internal->CompileOptionsEntries,
this->Internal->CompileOptionsBacktraces,
this->Internal->CompileOptionsItems);
CreatePropertyGeneratorExpressions(
this->Internal->CompileFeaturesEntries,
this->Internal->CompileFeaturesBacktraces,
this->Internal->CompileFeaturesItems);
CreatePropertyGeneratorExpressions(
this->Internal->CompileDefinitionsEntries,
this->Internal->CompileDefinitionsBacktraces,
this->Internal->CompileDefinitionsItems);
}
//----------------------------------------------------------------------------
void cmTarget::AddUtility(const std::string& u, cmMakefile *makefile)
{
@ -765,7 +802,7 @@ void cmTarget::GetSourceFiles(std::vector<std::string> &files,
this->LinkImplementationLanguageIsContextDependent = false;
}
deleteAndClear(linkInterfaceSourcesEntries);
cmDeleteAll(linkInterfaceSourcesEntries);
}
//----------------------------------------------------------------------------
@ -1666,39 +1703,35 @@ 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")
{
this->Internal->CompileOptionsEntries.clear();
this->Internal->CompileOptionsBacktraces.clear();
this->Internal->CompileOptionsEntries.push_back(value);
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
cmGeneratorExpression ge(lfbt);
deleteAndClear(this->Internal->CompileOptionsEntries);
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(value);
this->Internal->CompileOptionsEntries.push_back(
new cmTargetInternals::TargetPropertyEntry(cge));
this->Internal->CompileOptionsBacktraces.push_back(lfbt);
}
else if(prop == "COMPILE_FEATURES")
{
this->Internal->CompileFeaturesEntries.clear();
this->Internal->CompileFeaturesBacktraces.clear();
this->Internal->CompileFeaturesEntries.push_back(value);
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
cmGeneratorExpression ge(lfbt);
deleteAndClear(this->Internal->CompileFeaturesEntries);
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(value);
this->Internal->CompileFeaturesEntries.push_back(
new cmTargetInternals::TargetPropertyEntry(cge));
this->Internal->CompileFeaturesBacktraces.push_back(lfbt);
}
else if(prop == "COMPILE_DEFINITIONS")
{
this->Internal->CompileDefinitionsEntries.clear();
this->Internal->CompileDefinitionsBacktraces.clear();
this->Internal->CompileDefinitionsEntries.push_back(value);
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
cmGeneratorExpression ge(lfbt);
deleteAndClear(this->Internal->CompileDefinitionsEntries);
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(value);
this->Internal->CompileDefinitionsEntries.push_back(
new cmTargetInternals::TargetPropertyEntry(cge));
this->Internal->CompileDefinitionsBacktraces.push_back(lfbt);
}
else if(prop == "EXPORT_NAME" && this->IsImported())
{
@ -1764,31 +1797,27 @@ 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")
{
this->Internal->CompileOptionsEntries.push_back(value);
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
cmGeneratorExpression ge(lfbt);
this->Internal->CompileOptionsEntries.push_back(
new cmTargetInternals::TargetPropertyEntry(ge.Parse(value)));
this->Internal->CompileOptionsBacktraces.push_back(lfbt);
}
else if(prop == "COMPILE_FEATURES")
{
this->Internal->CompileFeaturesEntries.push_back(value);
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
cmGeneratorExpression ge(lfbt);
this->Internal->CompileFeaturesEntries.push_back(
new cmTargetInternals::TargetPropertyEntry(ge.Parse(value)));
this->Internal->CompileFeaturesBacktraces.push_back(lfbt);
}
else if(prop == "COMPILE_DEFINITIONS")
{
this->Internal->CompileDefinitionsEntries.push_back(value);
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
cmGeneratorExpression ge(lfbt);
this->Internal->CompileDefinitionsEntries.push_back(
new cmTargetInternals::TargetPropertyEntry(ge.Parse(value)));
this->Internal->CompileDefinitionsBacktraces.push_back(lfbt);
}
else if(prop == "EXPORT_NAME" && this->IsImported())
{
@ -1887,14 +1916,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);
}
//----------------------------------------------------------------------------
@ -1902,24 +1933,24 @@ void cmTarget::InsertCompileOption(std::string const& entry,
cmListFileBacktrace const& bt,
bool before)
{
cmGeneratorExpression ge(bt);
std::vector<std::string>::iterator position =
before ? this->Internal->CompileOptionsEntries.begin()
: this->Internal->CompileOptionsEntries.end();
std::vector<cmTargetInternals::TargetPropertyEntry*>::iterator position
= before ? this->Internal->CompileOptionsEntries.begin()
: this->Internal->CompileOptionsEntries.end();
std::vector<cmListFileBacktrace>::iterator btPosition =
before ? this->Internal->CompileOptionsBacktraces.begin()
: this->Internal->CompileOptionsBacktraces.end();
this->Internal->CompileOptionsEntries.insert(position,
new cmTargetInternals::TargetPropertyEntry(ge.Parse(entry)));
this->Internal->CompileOptionsEntries.insert(position, entry);
this->Internal->CompileOptionsBacktraces.insert(btPosition, bt);
}
//----------------------------------------------------------------------------
void cmTarget::InsertCompileDefinition(std::string const& entry,
cmListFileBacktrace const& bt)
{
cmGeneratorExpression ge(bt);
this->Internal->CompileDefinitionsEntries.push_back(
new cmTargetInternals::TargetPropertyEntry(ge.Parse(entry)));
this->Internal->CompileDefinitionsEntries.push_back(entry);
this->Internal->CompileDefinitionsBacktraces.push_back(bt);
}
//----------------------------------------------------------------------------
@ -2083,7 +2114,7 @@ cmTarget::GetIncludeDirectories(const std::string& config,
}
processIncludeDirectories(this,
this->Internal->IncludeDirectoriesEntries,
this->Internal->IncludeDirectoriesItems,
includes,
uniqueIncludes,
&dagChecker,
@ -2099,7 +2130,8 @@ cmTarget::GetIncludeDirectories(const std::string& config,
if(this->Makefile->IsOn("APPLE"))
{
LinkImplementation const* impl = this->GetLinkImplementation(config);
cmLinkImplementationLibraries const* impl =
this->GetLinkImplementationLibraries(config);
for(std::vector<cmLinkImplItem>::const_iterator
it = impl->Libraries.begin();
it != impl->Libraries.end(); ++it)
@ -2132,7 +2164,7 @@ cmTarget::GetIncludeDirectories(const std::string& config,
debugIncludes,
language);
deleteAndClear(linkInterfaceIncludeDirectoriesEntries);
cmDeleteAll(linkInterfaceIncludeDirectoriesEntries);
return includes;
}
@ -2229,7 +2261,7 @@ void cmTarget::GetCompileOptions(std::vector<std::string> &result,
}
processCompileOptions(this,
this->Internal->CompileOptionsEntries,
this->Internal->CompileOptionsItems,
result,
uniqueOptions,
&dagChecker,
@ -2253,7 +2285,7 @@ void cmTarget::GetCompileOptions(std::vector<std::string> &result,
debugOptions,
language);
deleteAndClear(linkInterfaceCompileOptionsEntries);
cmDeleteAll(linkInterfaceCompileOptionsEntries);
}
//----------------------------------------------------------------------------
@ -2300,7 +2332,7 @@ void cmTarget::GetCompileDefinitions(std::vector<std::string> &list,
}
processCompileDefinitions(this,
this->Internal->CompileDefinitionsEntries,
this->Internal->CompileDefinitionsItems,
list,
uniqueOptions,
&dagChecker,
@ -2355,7 +2387,7 @@ void cmTarget::GetCompileDefinitions(std::vector<std::string> &list,
debugDefines,
language);
deleteAndClear(linkInterfaceCompileDefinitionsEntries);
cmDeleteAll(linkInterfaceCompileDefinitionsEntries);
}
//----------------------------------------------------------------------------
@ -2401,7 +2433,7 @@ void cmTarget::GetCompileFeatures(std::vector<std::string> &result,
}
processCompileFeatures(this,
this->Internal->CompileFeaturesEntries,
this->Internal->CompileFeaturesItems,
result,
uniqueFeatures,
&dagChecker,
@ -2422,7 +2454,7 @@ void cmTarget::GetCompileFeatures(std::vector<std::string> &result,
config,
debugFeatures);
deleteAndClear(linkInterfaceCompileFeaturesEntries);
cmDeleteAll(linkInterfaceCompileFeaturesEntries);
}
//----------------------------------------------------------------------------
@ -2707,22 +2739,6 @@ bool cmTarget::HandleLocationPropertyPolicy(cmMakefile* context) const
return messageType != cmake::FATAL_ERROR;
}
//----------------------------------------------------------------------------
static void MakePropertyList(std::string& output,
std::vector<cmTargetInternals::TargetPropertyEntry*> const& values)
{
output = "";
std::string sep;
for (std::vector<cmTargetInternals::TargetPropertyEntry*>::const_iterator
it = values.begin(), end = values.end();
it != end; ++it)
{
output += sep;
output += (*it)->ge->GetInput();
sep = ";";
}
}
//----------------------------------------------------------------------------
const char *cmTarget::GetProperty(const std::string& prop) const
{
@ -2898,7 +2914,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)
@ -2909,7 +2925,7 @@ const char *cmTarget::GetProperty(const std::string& prop,
}
static std::string output;
MakePropertyList(output, this->Internal->CompileFeaturesEntries);
output = cmJoin(this->Internal->CompileFeaturesEntries, ";");
return output.c_str();
}
else if(prop == propCOMPILE_OPTIONS)
@ -2920,7 +2936,7 @@ const char *cmTarget::GetProperty(const std::string& prop,
}
static std::string output;
MakePropertyList(output, this->Internal->CompileOptionsEntries);
output = cmJoin(this->Internal->CompileOptionsEntries, ";");
return output.c_str();
}
else if(prop == propCOMPILE_DEFINITIONS)
@ -2931,7 +2947,7 @@ const char *cmTarget::GetProperty(const std::string& prop,
}
static std::string output;
MakePropertyList(output, this->Internal->CompileDefinitionsEntries);
output = cmJoin(this->Internal->CompileDefinitionsEntries, ";");
return output.c_str();
}
else if (prop == propIMPORTED)
@ -3381,7 +3397,7 @@ bool cmTarget::HaveBuildTreeRPATH(const std::string& config) const
{
return false;
}
if(LinkImplementationLibraries const* impl =
if(cmLinkImplementationLibraries const* impl =
this->GetLinkImplementationLibraries(config))
{
return !impl->Libraries.empty();
@ -4331,7 +4347,7 @@ cmTargetInternals::ComputeLinkInterfaceLibraries(
// to the link implementation.
{
// The link implementation is the default link interface.
cmTarget::LinkImplementationLibraries const* impl =
cmLinkImplementationLibraries const* impl =
thisTarget->GetLinkImplementationLibrariesInternal(config, headTarget);
iface.Libraries.insert(iface.Libraries.end(),
impl->Libraries.begin(), impl->Libraries.end());
@ -4431,7 +4447,7 @@ void cmTargetInternals::ComputeLinkInterface(cmTarget const* thisTarget,
|| thisTarget->GetPolicyStatusCMP0022() == cmPolicies::OLD)
{
// The link implementation is the default link interface.
cmTarget::LinkImplementationLibraries const*
cmLinkImplementationLibraries const*
impl = thisTarget->GetLinkImplementationLibrariesInternal(config,
headTarget);
iface.ImplementationIsInterface = true;
@ -4482,7 +4498,7 @@ void cmTargetInternals::AddInterfaceEntries(
cmTarget const* thisTarget, std::string const& config,
std::string const& prop, std::vector<TargetPropertyEntry*>& entries)
{
if(cmTarget::LinkImplementationLibraries const* impl =
if(cmLinkImplementationLibraries const* impl =
thisTarget->GetLinkImplementationLibraries(config))
{
for (std::vector<cmLinkImplItem>::const_iterator
@ -4532,14 +4548,14 @@ cmTarget::GetLinkImplementation(const std::string& config) const
}
//----------------------------------------------------------------------------
cmTarget::LinkImplementationLibraries const*
cmLinkImplementationLibraries const*
cmTarget::GetLinkImplementationLibraries(const std::string& config) const
{
return this->GetLinkImplementationLibrariesInternal(config, this);
}
//----------------------------------------------------------------------------
cmTarget::LinkImplementationLibraries const*
cmLinkImplementationLibraries const*
cmTarget::GetLinkImplementationLibrariesInternal(const std::string& config,
cmTarget const* head) const
{
@ -4804,10 +4820,10 @@ cmTargetInternalPointer
//----------------------------------------------------------------------------
cmTargetInternalPointer::~cmTargetInternalPointer()
{
cmDeleteAll(this->Pointer->IncludeDirectoriesEntries);
cmDeleteAll(this->Pointer->CompileOptionsEntries);
cmDeleteAll(this->Pointer->CompileFeaturesEntries);
cmDeleteAll(this->Pointer->CompileDefinitionsEntries);
cmDeleteAll(this->Pointer->IncludeDirectoriesItems);
cmDeleteAll(this->Pointer->CompileOptionsItems);
cmDeleteAll(this->Pointer->CompileFeaturesItems);
cmDeleteAll(this->Pointer->CompileDefinitionsItems);
cmDeleteAll(this->Pointer->SourceEntries);
delete this->Pointer;
}

View File

@ -16,6 +16,7 @@
#include "cmPropertyMap.h"
#include "cmPolicies.h"
#include "cmListFileCache.h"
#include "cmLinkItem.h"
#include <cmsys/auto_ptr.hxx>
#if defined(CMAKE_BUILD_WITH_CMAKE)
@ -52,32 +53,6 @@ class cmTarget;
class cmGeneratorTarget;
class cmTargetTraceDependencies;
// Basic information about each link item.
class cmLinkItem: public std::string
{
typedef std::string std_string;
public:
cmLinkItem(): std_string(), Target(0) {}
cmLinkItem(const std_string& n,
cmTarget const* t): std_string(n), Target(t) {}
cmLinkItem(cmLinkItem const& r): std_string(r), Target(r.Target) {}
cmTarget const* Target;
};
class cmLinkImplItem: public cmLinkItem
{
public:
cmLinkImplItem(): cmLinkItem(), Backtrace(), FromGenex(false) {}
cmLinkImplItem(std::string const& n,
cmTarget const* t,
cmListFileBacktrace const& bt,
bool fromGenex):
cmLinkItem(n, t), Backtrace(bt), FromGenex(fromGenex) {}
cmLinkImplItem(cmLinkImplItem const& r):
cmLinkItem(r), Backtrace(r.Backtrace), FromGenex(r.FromGenex) {}
cmListFileBacktrace Backtrace;
bool FromGenex;
};
class cmTargetInternals;
class cmTargetInternalPointer
{
@ -157,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
*/
@ -293,18 +270,7 @@ public:
cmTarget const* headTarget,
bool usage_requirements_only) const;
/** The link implementation specifies the direct library
dependencies needed by the object files of the target. */
struct LinkImplementationLibraries
{
// Libraries linked directly in this configuration.
std::vector<cmLinkImplItem> Libraries;
// Libraries linked directly in other configurations.
// Needed only for OLD behavior of CMP0003.
std::vector<cmLinkItem> WrongConfigLibraries;
};
struct LinkImplementation: public LinkImplementationLibraries
struct LinkImplementation: public cmLinkImplementationLibraries
{
// Languages whose runtime libraries must be linked.
std::vector<std::string> Languages;
@ -312,7 +278,7 @@ public:
LinkImplementation const*
GetLinkImplementation(const std::string& config) const;
LinkImplementationLibraries const*
cmLinkImplementationLibraries const*
GetLinkImplementationLibraries(const std::string& config) const;
cmTarget const* FindTargetToLink(std::string const& name) const;
@ -631,7 +597,7 @@ private:
GetImportLinkInterface(const std::string& config, cmTarget const* head,
bool usage_requirements_only) const;
LinkImplementationLibraries const*
cmLinkImplementationLibraries const*
GetLinkImplementationLibrariesInternal(const std::string& config,
cmTarget const* head) const;