ENH: When linking to versioned targets whose real file name is known pass the real name to the linker instead of the symlink name.
This commit is contained in:
parent
a752fc5e85
commit
07be6bb87b
|
@ -514,7 +514,8 @@ void cmComputeLinkInformation::AddItem(std::string const& item, cmTarget* tgt)
|
||||||
// platform. Add it now.
|
// platform. Add it now.
|
||||||
std::string linkItem;
|
std::string linkItem;
|
||||||
linkItem = this->LoaderFlag;
|
linkItem = this->LoaderFlag;
|
||||||
std::string exe = tgt->GetFullPath(config, this->UseImportLibrary);
|
std::string exe = tgt->GetFullPath(config, this->UseImportLibrary,
|
||||||
|
true);
|
||||||
linkItem += exe;
|
linkItem += exe;
|
||||||
this->Items.push_back(Item(linkItem, true));
|
this->Items.push_back(Item(linkItem, true));
|
||||||
this->Depends.push_back(exe);
|
this->Depends.push_back(exe);
|
||||||
|
@ -527,7 +528,7 @@ void cmComputeLinkInformation::AddItem(std::string const& item, cmTarget* tgt)
|
||||||
(impexe || tgt->GetType() == cmTarget::SHARED_LIBRARY));
|
(impexe || tgt->GetType() == cmTarget::SHARED_LIBRARY));
|
||||||
|
|
||||||
// Pass the full path to the target file.
|
// Pass the full path to the target file.
|
||||||
std::string lib = tgt->GetFullPath(config, implib);
|
std::string lib = tgt->GetFullPath(config, implib, true);
|
||||||
this->Depends.push_back(lib);
|
this->Depends.push_back(lib);
|
||||||
|
|
||||||
if(tgt->IsFrameworkOnApple())
|
if(tgt->IsFrameworkOnApple())
|
||||||
|
@ -1254,14 +1255,13 @@ cmComputeLinkInformation::AddLibraryRuntimeInfo(std::string const& fullPath,
|
||||||
std::string soName = target->GetSOName(this->Config);
|
std::string soName = target->GetSOName(this->Config);
|
||||||
const char* soname = soName.empty()? 0 : soName.c_str();
|
const char* soname = soName.empty()? 0 : soName.c_str();
|
||||||
|
|
||||||
// Add the library runtime entry.
|
// Include this library in the runtime path ordering.
|
||||||
this->AddLibraryRuntimeInfo(fullPath, soname);
|
this->OrderRuntimeSearchPath->AddLibrary(fullPath, soname);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void
|
void
|
||||||
cmComputeLinkInformation::AddLibraryRuntimeInfo(std::string const& fullPath,
|
cmComputeLinkInformation::AddLibraryRuntimeInfo(std::string const& fullPath)
|
||||||
const char* soname)
|
|
||||||
{
|
{
|
||||||
// Get the name of the library from the file name.
|
// Get the name of the library from the file name.
|
||||||
std::string file = cmSystemTools::GetFilenameName(fullPath);
|
std::string file = cmSystemTools::GetFilenameName(fullPath);
|
||||||
|
@ -1284,7 +1284,7 @@ cmComputeLinkInformation::AddLibraryRuntimeInfo(std::string const& fullPath,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Include this library in the runtime path ordering.
|
// Include this library in the runtime path ordering.
|
||||||
this->OrderRuntimeSearchPath->AddLibrary(fullPath, soname);
|
this->OrderRuntimeSearchPath->AddLibrary(fullPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
|
@ -162,8 +162,7 @@ private:
|
||||||
// Runtime path computation.
|
// Runtime path computation.
|
||||||
cmOrderRuntimeDirectories* OrderRuntimeSearchPath;
|
cmOrderRuntimeDirectories* OrderRuntimeSearchPath;
|
||||||
void AddLibraryRuntimeInfo(std::string const& fullPath, cmTarget* target);
|
void AddLibraryRuntimeInfo(std::string const& fullPath, cmTarget* target);
|
||||||
void AddLibraryRuntimeInfo(std::string const& fullPath,
|
void AddLibraryRuntimeInfo(std::string const& fullPath);
|
||||||
const char* soname = 0);
|
|
||||||
|
|
||||||
// Dependent library path computation.
|
// Dependent library path computation.
|
||||||
cmOrderRuntimeDirectories* OrderDependentRPath;
|
cmOrderRuntimeDirectories* OrderDependentRPath;
|
||||||
|
|
|
@ -2007,6 +2007,40 @@ std::string cmTarget::GetSOName(const char* config)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
std::string cmTarget::NormalGetRealName(const char* config)
|
||||||
|
{
|
||||||
|
// This should not be called for imported targets.
|
||||||
|
// TODO: Split cmTarget into a class hierarchy to get compile-time
|
||||||
|
// enforcement of the limited imported target API.
|
||||||
|
if(this->IsImported())
|
||||||
|
{
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(this->GetType() == cmTarget::EXECUTABLE)
|
||||||
|
{
|
||||||
|
// Compute the real name that will be built.
|
||||||
|
std::string name;
|
||||||
|
std::string realName;
|
||||||
|
std::string impName;
|
||||||
|
std::string pdbName;
|
||||||
|
this->GetExecutableNames(name, realName, impName, pdbName, config);
|
||||||
|
return realName;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Compute the real name that will be built.
|
||||||
|
std::string name;
|
||||||
|
std::string soName;
|
||||||
|
std::string realName;
|
||||||
|
std::string impName;
|
||||||
|
std::string pdbName;
|
||||||
|
this->GetLibraryNames(name, soName, realName, impName, pdbName, config);
|
||||||
|
return realName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
std::string cmTarget::GetFullName(const char* config, bool implib)
|
std::string cmTarget::GetFullName(const char* config, bool implib)
|
||||||
{
|
{
|
||||||
|
@ -2037,7 +2071,8 @@ void cmTarget::GetFullNameComponents(std::string& prefix, std::string& base,
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
std::string cmTarget::GetFullPath(const char* config, bool implib)
|
std::string cmTarget::GetFullPath(const char* config, bool implib,
|
||||||
|
bool realname)
|
||||||
{
|
{
|
||||||
if(this->IsImported())
|
if(this->IsImported())
|
||||||
{
|
{
|
||||||
|
@ -2045,19 +2080,27 @@ std::string cmTarget::GetFullPath(const char* config, bool implib)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return this->NormalGetFullPath(config, implib);
|
return this->NormalGetFullPath(config, implib, realname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
std::string cmTarget::NormalGetFullPath(const char* config, bool implib)
|
std::string cmTarget::NormalGetFullPath(const char* config, bool implib,
|
||||||
|
bool realname)
|
||||||
{
|
{
|
||||||
// Start with the output directory for the target.
|
// Start with the output directory for the target.
|
||||||
std::string fpath = this->GetDirectory(config, implib);
|
std::string fpath = this->GetDirectory(config, implib);
|
||||||
fpath += "/";
|
fpath += "/";
|
||||||
|
|
||||||
// Add the full name of the target.
|
// Add the full name of the target.
|
||||||
|
if(realname)
|
||||||
|
{
|
||||||
|
fpath += this->NormalGetRealName(config);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
fpath += this->GetFullName(config, implib);
|
fpath += this->GetFullName(config, implib);
|
||||||
|
}
|
||||||
return fpath;
|
return fpath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -260,7 +260,8 @@ public:
|
||||||
|
|
||||||
/** Get the full path to the target according to the settings in its
|
/** Get the full path to the target according to the settings in its
|
||||||
makefile and the configuration type. */
|
makefile and the configuration type. */
|
||||||
std::string GetFullPath(const char* config=0, bool implib = false);
|
std::string GetFullPath(const char* config=0, bool implib = false,
|
||||||
|
bool realname = false);
|
||||||
|
|
||||||
/** Get the names of the library needed to generate a build rule
|
/** Get the names of the library needed to generate a build rule
|
||||||
that takes into account shared library version numbers. This
|
that takes into account shared library version numbers. This
|
||||||
|
@ -437,7 +438,14 @@ private:
|
||||||
const char* NormalGetDirectory(const char* config, bool implib);
|
const char* NormalGetDirectory(const char* config, bool implib);
|
||||||
|
|
||||||
std::string ImportedGetFullPath(const char* config, bool implib);
|
std::string ImportedGetFullPath(const char* config, bool implib);
|
||||||
std::string NormalGetFullPath(const char* config, bool implib);
|
std::string NormalGetFullPath(const char* config, bool implib,
|
||||||
|
bool realname);
|
||||||
|
|
||||||
|
/** Get the real name of the target. Allowed only for non-imported
|
||||||
|
targets. When a library or executable file is versioned this is
|
||||||
|
the full versioned name. If the target is not versioned this is
|
||||||
|
the same as GetFullName. */
|
||||||
|
std::string NormalGetRealName(const char* config);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string Name;
|
std::string Name;
|
||||||
|
|
Loading…
Reference in New Issue