summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2010-12-09 16:18:25 (GMT)
committerBrad King <brad.king@kitware.com>2010-12-09 16:18:25 (GMT)
commit3b7f9014942dc79a24c90904312af768a180ae9d (patch)
tree9ce740ad5d0380b99809596a399bd08c9257c88b /Source
parentd25638ac0519fde108a8743ca0a8831d8512af5e (diff)
downloadCMake-3b7f9014942dc79a24c90904312af768a180ae9d.zip
CMake-3b7f9014942dc79a24c90904312af768a180ae9d.tar.gz
CMake-3b7f9014942dc79a24c90904312af768a180ae9d.tar.bz2
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>
Diffstat (limited to 'Source')
-rw-r--r--Source/cmTarget.cxx39
1 files changed, 24 insertions, 15 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index ca61b1f..a226c40 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -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__)
- soName = prefix+base;
-#else
- soName = name;
-#endif
+ if(isApple)
+ {
+ soName = prefix+base;
+ }
+ else
+ {
+ soName = name;
+ }
if(soversion)
{
soName += ".";
soName += soversion;
}
-#if defined(__APPLE__)
- soName += suffix;
-#endif
+ if(isApple)
+ {
+ soName += suffix;
+ }
// The library's real name on disk.
-#if defined(__APPLE__)
- realName = prefix+base;
-#else
+ if(isApple)
+ {
+ realName = prefix+base;
+ }
+ else
+ {
realName = name;
-#endif
+ }
if(version)
{
realName += ".";
@@ -3237,9 +3245,10 @@ void cmTarget::GetLibraryNames(std::string& name,
realName += ".";
realName += soversion;
}
-#if defined(__APPLE__)
- realName += suffix;
-#endif
+ if(isApple)
+ {
+ realName += suffix;
+ }
// The import library name.
if(this->GetType() == cmTarget::SHARED_LIBRARY ||