mirror of
https://github.com/reactos/CMake.git
synced 2024-11-24 20:19:53 +00:00
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_SEP ":")
|
||||
|
||||
# Files named "libfoo.a" may actually be shared libraries.
|
||||
SET_PROPERTY(GLOBAL PROPERTY TARGET_ARCHIVES_MAY_BE_SHARED_LIBS 1)
|
||||
|
||||
# CXX Compiler
|
||||
IF(CMAKE_COMPILER_IS_GNUCXX)
|
||||
SET(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-shared -Wl,-G") # -shared
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "cmLocalGenerator.h"
|
||||
#include "cmMakefile.h"
|
||||
#include "cmTarget.h"
|
||||
#include "cmake.h"
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
@ -222,6 +223,7 @@ cmComputeLinkInformation
|
||||
this->Makefile = this->Target->GetMakefile();
|
||||
this->LocalGenerator = this->Makefile->GetLocalGenerator();
|
||||
this->GlobalGenerator = this->LocalGenerator->GetGlobalGenerator();
|
||||
this->CMakeInstance = this->GlobalGenerator->GetCMakeInstance();
|
||||
|
||||
// The configuration being linked.
|
||||
this->Config = config;
|
||||
@ -649,6 +651,11 @@ void cmComputeLinkInformation::AddSharedDepItem(std::string const& item,
|
||||
//----------------------------------------------------------------------------
|
||||
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.
|
||||
this->LinkTypeEnabled = false;
|
||||
|
||||
@ -1260,8 +1267,20 @@ cmComputeLinkInformation::AddLibraryRuntimeInfo(std::string const& fullPath,
|
||||
std::string file = cmSystemTools::GetFilenameName(fullPath);
|
||||
if(!this->ExtractSharedLibraryName.find(file.c_str()))
|
||||
{
|
||||
// This is not the name of a shared library.
|
||||
return;
|
||||
// On some platforms (AIX) a shared library may look static.
|
||||
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.
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
#include <cmsys/RegularExpression.hxx>
|
||||
|
||||
class cmake;
|
||||
class cmGlobalGenerator;
|
||||
class cmLocalGenerator;
|
||||
class cmMakefile;
|
||||
@ -79,6 +80,7 @@ private:
|
||||
cmMakefile* Makefile;
|
||||
cmLocalGenerator* LocalGenerator;
|
||||
cmGlobalGenerator* GlobalGenerator;
|
||||
cmake* CMakeInstance;
|
||||
|
||||
// Configuration information.
|
||||
const char* Config;
|
||||
@ -114,6 +116,7 @@ private:
|
||||
std::string SharedLinkTypeFlag;
|
||||
bool LinkTypeEnabled;
|
||||
void SetCurrentLinkType(LinkType lt);
|
||||
bool ArchivesMayBeShared;
|
||||
|
||||
// Link item parsing.
|
||||
void ComputeItemParserInfo();
|
||||
|
@ -3245,6 +3245,13 @@ void cmake::DefineProperties(cmake *cm)
|
||||
"platform supports shared libraries. Basically all current general "
|
||||
"general purpose OS do so, the exception are usually embedded systems "
|
||||
"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
|
||||
("FIND_LIBRARY_USE_LIB64_PATHS", cmProperty::GLOBAL,
|
||||
"Whether FIND_LIBRARY should automatically search lib64 directories.",
|
||||
|
Loading…
Reference in New Issue
Block a user