mirror of
https://github.com/reactos/CMake.git
synced 2024-11-24 03:59:58 +00:00
Constify handling of link targets.
This commit is contained in:
parent
ef25ba8d06
commit
9edee62f28
@ -619,19 +619,19 @@ cmComputeLinkDepends::AddLinkEntries(int depender_index,
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
cmTarget* cmComputeLinkDepends::FindTargetToLink(int depender_index,
|
||||
cmTarget const* cmComputeLinkDepends::FindTargetToLink(int depender_index,
|
||||
const char* name)
|
||||
{
|
||||
// Look for a target in the scope of the depender.
|
||||
cmMakefile* mf = this->Makefile;
|
||||
if(depender_index >= 0)
|
||||
{
|
||||
if(cmTarget* depender = this->EntryList[depender_index].Target)
|
||||
if(cmTarget const* depender = this->EntryList[depender_index].Target)
|
||||
{
|
||||
mf = depender->GetMakefile();
|
||||
}
|
||||
}
|
||||
cmTarget* tgt = mf->FindTargetToUse(name);
|
||||
cmTarget const* tgt = mf->FindTargetToUse(name);
|
||||
|
||||
// Skip targets that will not really be linked. This is probably a
|
||||
// name conflict between an external library and an executable
|
||||
@ -950,7 +950,7 @@ int cmComputeLinkDepends::ComputeComponentCount(NodeList const& nl)
|
||||
int count = 2;
|
||||
for(NodeList::const_iterator ni = nl.begin(); ni != nl.end(); ++ni)
|
||||
{
|
||||
if(cmTarget* target = this->EntryList[*ni].Target)
|
||||
if(cmTarget const* target = this->EntryList[*ni].Target)
|
||||
{
|
||||
if(cmTarget::LinkInterface const* iface =
|
||||
target->GetLinkInterface(this->Config, this->HeadTarget))
|
||||
@ -997,7 +997,8 @@ void cmComputeLinkDepends::CheckWrongConfigItem(int depender_index,
|
||||
// For CMake 2.4 bug-compatibility we need to consider the output
|
||||
// directories of targets linked in another configuration as link
|
||||
// directories.
|
||||
if(cmTarget* tgt = this->FindTargetToLink(depender_index, item.c_str()))
|
||||
if(cmTarget const* tgt
|
||||
= this->FindTargetToLink(depender_index, item.c_str()))
|
||||
{
|
||||
if(!tgt->IsImported())
|
||||
{
|
||||
|
@ -40,7 +40,7 @@ public:
|
||||
struct LinkEntry
|
||||
{
|
||||
std::string Item;
|
||||
cmTarget* Target;
|
||||
cmTarget const* Target;
|
||||
bool IsSharedDep;
|
||||
bool IsFlag;
|
||||
LinkEntry(): Item(), Target(0), IsSharedDep(false), IsFlag(false) {}
|
||||
@ -53,7 +53,7 @@ public:
|
||||
EntryVector const& Compute();
|
||||
|
||||
void SetOldLinkDirMode(bool b);
|
||||
std::set<cmTarget*> const& GetOldWrongConfigItems() const
|
||||
std::set<cmTarget const*> const& GetOldWrongConfigItems() const
|
||||
{ return this->OldWrongConfigItems; }
|
||||
|
||||
private:
|
||||
@ -83,7 +83,7 @@ private:
|
||||
void AddDirectLinkEntries();
|
||||
void AddLinkEntries(int depender_index,
|
||||
std::vector<std::string> const& libs);
|
||||
cmTarget* FindTargetToLink(int depender_index, const char* name);
|
||||
cmTarget const* FindTargetToLink(int depender_index, const char* name);
|
||||
|
||||
// One entry for each unique item.
|
||||
std::vector<LinkEntry> EntryList;
|
||||
@ -164,7 +164,7 @@ private:
|
||||
// Compatibility help.
|
||||
bool OldLinkDirMode;
|
||||
void CheckWrongConfigItem(int depender_index, std::string const& item);
|
||||
std::set<cmTarget*> OldWrongConfigItems;
|
||||
std::set<cmTarget const*> OldWrongConfigItems;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -477,7 +477,7 @@ std::vector<std::string> const& cmComputeLinkInformation::GetFrameworkPaths()
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
std::set<cmTarget*> const&
|
||||
std::set<cmTarget const*> const&
|
||||
cmComputeLinkInformation::GetSharedLibrariesLinked()
|
||||
{
|
||||
return this->SharedLibrariesLinked;
|
||||
@ -542,11 +542,11 @@ bool cmComputeLinkInformation::Compute()
|
||||
// For CMake 2.4 bug-compatibility we need to consider the output
|
||||
// directories of targets linked in another configuration as link
|
||||
// directories.
|
||||
std::set<cmTarget*> const& wrongItems = cld.GetOldWrongConfigItems();
|
||||
for(std::set<cmTarget*>::const_iterator i = wrongItems.begin();
|
||||
std::set<cmTarget const*> const& wrongItems = cld.GetOldWrongConfigItems();
|
||||
for(std::set<cmTarget const*>::const_iterator i = wrongItems.begin();
|
||||
i != wrongItems.end(); ++i)
|
||||
{
|
||||
cmTarget* tgt = *i;
|
||||
cmTarget const* tgt = *i;
|
||||
bool implib =
|
||||
(this->UseImportLibrary &&
|
||||
(tgt->GetType() == cmTarget::SHARED_LIBRARY));
|
||||
@ -620,7 +620,8 @@ void cmComputeLinkInformation::AddImplicitLinkInfo(std::string const& lang)
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void cmComputeLinkInformation::AddItem(std::string const& item, cmTarget* tgt)
|
||||
void cmComputeLinkInformation::AddItem(std::string const& item,
|
||||
cmTarget const* tgt)
|
||||
{
|
||||
// Compute the proper name to use to link this library.
|
||||
const char* config = this->Config;
|
||||
@ -700,7 +701,7 @@ void cmComputeLinkInformation::AddItem(std::string const& item, cmTarget* tgt)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void cmComputeLinkInformation::AddSharedDepItem(std::string const& item,
|
||||
cmTarget* tgt)
|
||||
cmTarget const* tgt)
|
||||
{
|
||||
// If dropping shared library dependencies, ignore them.
|
||||
if(this->SharedDependencyMode == SharedDepModeNone)
|
||||
@ -1062,7 +1063,7 @@ void cmComputeLinkInformation::SetCurrentLinkType(LinkType lt)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void cmComputeLinkInformation::AddTargetItem(std::string const& item,
|
||||
cmTarget* target)
|
||||
cmTarget const* target)
|
||||
{
|
||||
// This is called to handle a link item that is a full path to a target.
|
||||
// If the target is not a static library make sure the link type is
|
||||
@ -1744,7 +1745,7 @@ cmComputeLinkInformation::GetRuntimeSearchPath()
|
||||
//----------------------------------------------------------------------------
|
||||
void
|
||||
cmComputeLinkInformation::AddLibraryRuntimeInfo(std::string const& fullPath,
|
||||
cmTarget* target)
|
||||
cmTarget const* target)
|
||||
{
|
||||
// Ignore targets on Apple where install_name is not @rpath.
|
||||
// The dependenty library can be found with other means such as
|
||||
|
@ -39,11 +39,11 @@ public:
|
||||
Item(): Value(), IsPath(true), Target(0) {}
|
||||
Item(Item const& item):
|
||||
Value(item.Value), IsPath(item.IsPath), Target(item.Target) {}
|
||||
Item(std::string const& v, bool p, cmTarget* target = 0):
|
||||
Item(std::string const& v, bool p, cmTarget const* target = 0):
|
||||
Value(v), IsPath(p), Target(target) {}
|
||||
std::string Value;
|
||||
bool IsPath;
|
||||
cmTarget* Target;
|
||||
cmTarget const* Target;
|
||||
};
|
||||
typedef std::vector<Item> ItemVector;
|
||||
ItemVector const& GetItems();
|
||||
@ -57,13 +57,13 @@ public:
|
||||
void GetRPath(std::vector<std::string>& runtimeDirs, bool for_install);
|
||||
std::string GetRPathString(bool for_install);
|
||||
std::string GetChrpathString();
|
||||
std::set<cmTarget*> const& GetSharedLibrariesLinked();
|
||||
std::set<cmTarget const*> const& GetSharedLibrariesLinked();
|
||||
|
||||
std::string const& GetRPathLinkFlag() const { return this->RPathLinkFlag; }
|
||||
std::string GetRPathLinkString();
|
||||
private:
|
||||
void AddItem(std::string const& item, cmTarget* tgt);
|
||||
void AddSharedDepItem(std::string const& item, cmTarget* tgt);
|
||||
void AddItem(std::string const& item, cmTarget const* tgt);
|
||||
void AddSharedDepItem(std::string const& item, cmTarget const* tgt);
|
||||
|
||||
// Output information.
|
||||
ItemVector Items;
|
||||
@ -71,7 +71,7 @@ private:
|
||||
std::vector<std::string> Depends;
|
||||
std::vector<std::string> FrameworkPaths;
|
||||
std::vector<std::string> RuntimeSearchPath;
|
||||
std::set<cmTarget*> SharedLibrariesLinked;
|
||||
std::set<cmTarget const*> SharedLibrariesLinked;
|
||||
|
||||
// Context information.
|
||||
cmTarget const* Target;
|
||||
@ -139,7 +139,7 @@ private:
|
||||
std::string NoCaseExpression(const char* str);
|
||||
|
||||
// Handling of link items.
|
||||
void AddTargetItem(std::string const& item, cmTarget* target);
|
||||
void AddTargetItem(std::string const& item, cmTarget const* target);
|
||||
void AddFullItem(std::string const& item);
|
||||
bool CheckImplicitDirItem(std::string const& item);
|
||||
void AddUserItem(std::string const& item, bool pathNotKnown);
|
||||
@ -179,7 +179,8 @@ private:
|
||||
|
||||
// Runtime path computation.
|
||||
cmOrderDirectories* OrderRuntimeSearchPath;
|
||||
void AddLibraryRuntimeInfo(std::string const& fullPath, cmTarget* target);
|
||||
void AddLibraryRuntimeInfo(std::string const& fullPath,
|
||||
cmTarget const* target);
|
||||
void AddLibraryRuntimeInfo(std::string const& fullPath);
|
||||
|
||||
// Dependent library path computation.
|
||||
|
@ -402,7 +402,7 @@ void cmExportFileGenerator::PopulateInterfaceProperty(const char *propName,
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void getPropertyContents(cmTarget *tgt, const char *prop,
|
||||
void getPropertyContents(cmTarget const* tgt, const char *prop,
|
||||
std::set<std::string> &ifaceProperties)
|
||||
{
|
||||
const char *p = tgt->GetProperty(prop);
|
||||
|
@ -328,9 +328,10 @@ cmInstallTargetGenerator::GetInstallFilename(const char* config) const
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
std::string cmInstallTargetGenerator::GetInstallFilename(cmTarget* target,
|
||||
const char* config,
|
||||
NameType nameType)
|
||||
std::string
|
||||
cmInstallTargetGenerator::GetInstallFilename(cmTarget const* target,
|
||||
const char* config,
|
||||
NameType nameType)
|
||||
{
|
||||
std::string fname;
|
||||
// Compute the name of the library.
|
||||
@ -515,11 +516,12 @@ cmInstallTargetGenerator
|
||||
std::map<cmStdString, cmStdString> install_name_remap;
|
||||
if(cmComputeLinkInformation* cli = this->Target->GetLinkInformation(config))
|
||||
{
|
||||
std::set<cmTarget*> const& sharedLibs = cli->GetSharedLibrariesLinked();
|
||||
for(std::set<cmTarget*>::const_iterator j = sharedLibs.begin();
|
||||
std::set<cmTarget const*> const& sharedLibs
|
||||
= cli->GetSharedLibrariesLinked();
|
||||
for(std::set<cmTarget const*>::const_iterator j = sharedLibs.begin();
|
||||
j != sharedLibs.end(); ++j)
|
||||
{
|
||||
cmTarget* tgt = *j;
|
||||
cmTarget const* tgt = *j;
|
||||
|
||||
// The install_name of an imported target does not change.
|
||||
if(tgt->IsImported())
|
||||
|
@ -53,7 +53,8 @@ public:
|
||||
NameReal
|
||||
};
|
||||
|
||||
static std::string GetInstallFilename(cmTarget*target, const char* config,
|
||||
static std::string GetInstallFilename(cmTarget const* target,
|
||||
const char* config,
|
||||
NameType nameType = NameNormal);
|
||||
|
||||
cmTarget* GetTarget() const { return this->Target; }
|
||||
|
@ -5763,7 +5763,8 @@ const char * getLinkInterfaceDependentProperty(cmTarget const* tgt,
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
template<typename PropertyType>
|
||||
void checkPropertyConsistency(cmTarget const* depender, cmTarget *dependee,
|
||||
void checkPropertyConsistency(cmTarget const* depender,
|
||||
cmTarget const* dependee,
|
||||
const char *propName,
|
||||
std::set<cmStdString> &emitted,
|
||||
const char *config,
|
||||
|
Loading…
Reference in New Issue
Block a user