[cmake-developers] SONAME on APPLE?
Stephen Kelly
steveire at gmail.com
Mon Jul 9 12:17:28 EDT 2012
Hi there,
The patch at:
https://codereview.qt-project.org/#change,30084
sets the IMPORTED_SONAME on linux for Qt 5 IMPORTED targets. I don't know
whether it should also be set on APPLE, but I have now done some
investigation.
I created a dummy project to test the output created by CMake when
generating IMPORTING targets with install(EXPORT).
It seems that on APPLE, otool -D <the_lib> will output the "shared library
id name". I don't know for certain that it is the same thing (I know very
little about APPLE), but CMake seems to set that based on the name of the
library, the SOVERSION property, and the file suffix. So far it seems
similar to the SONAME reported by objdump on linux.
CMake seems to populate the "shared library id name" (Let's call it SONAME
for now, even on APPLE) with a full path when the library is in the build
directory ("/Users/kdab/dev/cmake/build/libcmakeqt.5.dylib"), and without
the path when installed (Only "libcmakeqt.5.dylib").
I don't know if that is configurable.
I didn't find any way to create 'frameworks' with CMake, so I don't know if
there is even the concept of a SONAME when creating a 'framework' on APPLE.
Running otool -D on QtCore from Qt 5 (configured with -no-frameworks), I get
a full path to the install location when running it on the binaries in both
the build location and the install location.
Running otool -D on QtCore from Qt 5 (configured as it is by default, that
is, with -frameworks), I get a full versioned path to
QtCore.framework/Versions/5/QtCore in the install location when run on
QtCore.framework/QtCore in both the build dir and the install dir.
CMake seems to use this information to compute the link line, so it would
seem advantagous that I set it correctly on relevant platforms. Can anyone
add clarity to anything I wrote? Should I set the IMPORTED_SONAME to these
full paths to the installation location on APPLE? Wouldn't that make the
frameworks non-relocatable, or is that a bug in Qt anyway?
Thanks,
Steve.
More information about the cmake-developers
mailing list