Fix soname in cross-compiled targets with Mac host (#11547)
The soname generation code was compile-time selected instead of runtime selected. The result is that a Mac-compiled cmake used to cross-compile Mac -> Unix generates an soname of the form libfoo.x.y.so instead of libfoo.so.x.y as expected. Instead do a runtime check based on the target platform. Inspired-By: George Staikos <staikos@kde.org>
This commit is contained in:
parent
d25638ac05
commit
3b7f901494
|
@ -3196,6 +3196,7 @@ void cmTarget::GetLibraryNames(std::string& name,
|
|||
// the library version as the soversion.
|
||||
soversion = version;
|
||||
}
|
||||
bool isApple = this->Makefile->IsOn("APPLE");
|
||||
|
||||
// Get the components of the library name.
|
||||
std::string prefix;
|
||||
|
@ -3207,26 +3208,33 @@ void cmTarget::GetLibraryNames(std::string& name,
|
|||
name = prefix+base+suffix;
|
||||
|
||||
// The library's soname.
|
||||
#if defined(__APPLE__)
|
||||
if(isApple)
|
||||
{
|
||||
soName = prefix+base;
|
||||
#else
|
||||
}
|
||||
else
|
||||
{
|
||||
soName = name;
|
||||
#endif
|
||||
}
|
||||
if(soversion)
|
||||
{
|
||||
soName += ".";
|
||||
soName += soversion;
|
||||
}
|
||||
#if defined(__APPLE__)
|
||||
if(isApple)
|
||||
{
|
||||
soName += suffix;
|
||||
#endif
|
||||
}
|
||||
|
||||
// The library's real name on disk.
|
||||
#if defined(__APPLE__)
|
||||
if(isApple)
|
||||
{
|
||||
realName = prefix+base;
|
||||
#else
|
||||
}
|
||||
else
|
||||
{
|
||||
realName = name;
|
||||
#endif
|
||||
}
|
||||
if(version)
|
||||
{
|
||||
realName += ".";
|
||||
|
@ -3237,9 +3245,10 @@ void cmTarget::GetLibraryNames(std::string& name,
|
|||
realName += ".";
|
||||
realName += soversion;
|
||||
}
|
||||
#if defined(__APPLE__)
|
||||
if(isApple)
|
||||
{
|
||||
realName += suffix;
|
||||
#endif
|
||||
}
|
||||
|
||||
// The import library name.
|
||||
if(this->GetType() == cmTarget::SHARED_LIBRARY ||
|
||||
|
|
Loading…
Reference in New Issue