BUG: Added TARGET_ARCHIVES_MAY_BE_SHARED_LIBS global property to help compute proper rpath information on AIX when shared libraries have names like "libfoo.a".
This commit is contained in:
parent
c12a7e388d
commit
847c8403fe
|
@ -12,6 +12,9 @@ SET(CMAKE_PLATFORM_REQUIRED_RUNTIME_PATH /usr/lib /lib)
|
||||||
SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-blibpath:")
|
SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-blibpath:")
|
||||||
SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":")
|
SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":")
|
||||||
|
|
||||||
|
# Files named "libfoo.a" may actually be shared libraries.
|
||||||
|
SET_PROPERTY(GLOBAL PROPERTY TARGET_ARCHIVES_MAY_BE_SHARED_LIBS 1)
|
||||||
|
|
||||||
# CXX Compiler
|
# CXX Compiler
|
||||||
IF(CMAKE_COMPILER_IS_GNUCXX)
|
IF(CMAKE_COMPILER_IS_GNUCXX)
|
||||||
SET(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-shared -Wl,-G") # -shared
|
SET(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-shared -Wl,-G") # -shared
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include "cmLocalGenerator.h"
|
#include "cmLocalGenerator.h"
|
||||||
#include "cmMakefile.h"
|
#include "cmMakefile.h"
|
||||||
#include "cmTarget.h"
|
#include "cmTarget.h"
|
||||||
|
#include "cmake.h"
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
|
@ -222,6 +223,7 @@ cmComputeLinkInformation
|
||||||
this->Makefile = this->Target->GetMakefile();
|
this->Makefile = this->Target->GetMakefile();
|
||||||
this->LocalGenerator = this->Makefile->GetLocalGenerator();
|
this->LocalGenerator = this->Makefile->GetLocalGenerator();
|
||||||
this->GlobalGenerator = this->LocalGenerator->GetGlobalGenerator();
|
this->GlobalGenerator = this->LocalGenerator->GetGlobalGenerator();
|
||||||
|
this->CMakeInstance = this->GlobalGenerator->GetCMakeInstance();
|
||||||
|
|
||||||
// The configuration being linked.
|
// The configuration being linked.
|
||||||
this->Config = config;
|
this->Config = config;
|
||||||
|
@ -649,6 +651,11 @@ void cmComputeLinkInformation::AddSharedDepItem(std::string const& item,
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void cmComputeLinkInformation::ComputeLinkTypeInfo()
|
void cmComputeLinkInformation::ComputeLinkTypeInfo()
|
||||||
{
|
{
|
||||||
|
// Check whether archives may actually be shared libraries.
|
||||||
|
this->ArchivesMayBeShared =
|
||||||
|
this->CMakeInstance->GetPropertyAsBool(
|
||||||
|
"TARGET_ARCHIVES_MAY_BE_SHARED_LIBS");
|
||||||
|
|
||||||
// First assume we cannot do link type stuff.
|
// First assume we cannot do link type stuff.
|
||||||
this->LinkTypeEnabled = false;
|
this->LinkTypeEnabled = false;
|
||||||
|
|
||||||
|
@ -1260,8 +1267,20 @@ cmComputeLinkInformation::AddLibraryRuntimeInfo(std::string const& fullPath,
|
||||||
std::string file = cmSystemTools::GetFilenameName(fullPath);
|
std::string file = cmSystemTools::GetFilenameName(fullPath);
|
||||||
if(!this->ExtractSharedLibraryName.find(file.c_str()))
|
if(!this->ExtractSharedLibraryName.find(file.c_str()))
|
||||||
{
|
{
|
||||||
// This is not the name of a shared library.
|
// On some platforms (AIX) a shared library may look static.
|
||||||
return;
|
if(this->ArchivesMayBeShared)
|
||||||
|
{
|
||||||
|
if(!this->ExtractStaticLibraryName.find(file.c_str()))
|
||||||
|
{
|
||||||
|
// This is not the name of a shared library or archive.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// This is not the name of a shared library.
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Include this library in the runtime path ordering.
|
// Include this library in the runtime path ordering.
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
#include <cmsys/RegularExpression.hxx>
|
#include <cmsys/RegularExpression.hxx>
|
||||||
|
|
||||||
|
class cmake;
|
||||||
class cmGlobalGenerator;
|
class cmGlobalGenerator;
|
||||||
class cmLocalGenerator;
|
class cmLocalGenerator;
|
||||||
class cmMakefile;
|
class cmMakefile;
|
||||||
|
@ -79,6 +80,7 @@ private:
|
||||||
cmMakefile* Makefile;
|
cmMakefile* Makefile;
|
||||||
cmLocalGenerator* LocalGenerator;
|
cmLocalGenerator* LocalGenerator;
|
||||||
cmGlobalGenerator* GlobalGenerator;
|
cmGlobalGenerator* GlobalGenerator;
|
||||||
|
cmake* CMakeInstance;
|
||||||
|
|
||||||
// Configuration information.
|
// Configuration information.
|
||||||
const char* Config;
|
const char* Config;
|
||||||
|
@ -114,6 +116,7 @@ private:
|
||||||
std::string SharedLinkTypeFlag;
|
std::string SharedLinkTypeFlag;
|
||||||
bool LinkTypeEnabled;
|
bool LinkTypeEnabled;
|
||||||
void SetCurrentLinkType(LinkType lt);
|
void SetCurrentLinkType(LinkType lt);
|
||||||
|
bool ArchivesMayBeShared;
|
||||||
|
|
||||||
// Link item parsing.
|
// Link item parsing.
|
||||||
void ComputeItemParserInfo();
|
void ComputeItemParserInfo();
|
||||||
|
|
|
@ -3245,6 +3245,13 @@ void cmake::DefineProperties(cmake *cm)
|
||||||
"platform supports shared libraries. Basically all current general "
|
"platform supports shared libraries. Basically all current general "
|
||||||
"general purpose OS do so, the exception are usually embedded systems "
|
"general purpose OS do so, the exception are usually embedded systems "
|
||||||
"with no or special OSs.");
|
"with no or special OSs.");
|
||||||
|
|
||||||
|
cm->DefineProperty
|
||||||
|
("TARGET_ARCHIVES_MAY_BE_SHARED_LIBS", cmProperty::GLOBAL,
|
||||||
|
"Set if shared libraries may be named like archives.",
|
||||||
|
"On AIX shared libraries may be named \"lib<name>.a\". "
|
||||||
|
"This property is set to true on such platforms.");
|
||||||
|
|
||||||
cm->DefineProperty
|
cm->DefineProperty
|
||||||
("FIND_LIBRARY_USE_LIB64_PATHS", cmProperty::GLOBAL,
|
("FIND_LIBRARY_USE_LIB64_PATHS", cmProperty::GLOBAL,
|
||||||
"Whether FIND_LIBRARY should automatically search lib64 directories.",
|
"Whether FIND_LIBRARY should automatically search lib64 directories.",
|
||||||
|
|
Loading…
Reference in New Issue