[Cmake-commits] CMake branch, next, updated. v2.8.6-2213-g13a4f9f
Brad King
brad.king at kitware.com
Wed Dec 14 15:09:29 EST 2011
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".
The branch, next has been updated
via 13a4f9f8c7feb4f1cbff9c8dbd5cb06d55e472a7 (commit)
via 5206960965cf20a6f5361c4a1e70fdc091150ea7 (commit)
from 7972ed07eebeeaa9222acc035b0f14042421a86e (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=13a4f9f8c7feb4f1cbff9c8dbd5cb06d55e472a7
commit 13a4f9f8c7feb4f1cbff9c8dbd5cb06d55e472a7
Merge: 7972ed0 5206960
Author: Brad King <brad.king at kitware.com>
AuthorDate: Wed Dec 14 15:09:17 2011 -0500
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Wed Dec 14 15:09:17 2011 -0500
Merge topic 'osx-dependent-libraries' into next
5206960 Do not link private dependent shared libraries on OS X > 10.4
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5206960965cf20a6f5361c4a1e70fdc091150ea7
commit 5206960965cf20a6f5361c4a1e70fdc091150ea7
Author: Brad King <brad.king at kitware.com>
AuthorDate: Wed Dec 14 13:59:39 2011 -0500
Commit: Brad King <brad.king at kitware.com>
CommitDate: Wed Dec 14 14:29:23 2011 -0500
Do not link private dependent shared libraries on OS X > 10.4
The default OS X 10.4 linker incorrectly searches for dependencies of
linked shared libraries only under the -isysroot location. It fails to
find dependencies of linked shared libraries in cases such as the
ExportImport test. It produces errors like:
/usr/libexec/gcc/i686-apple-darwin8/4.0.1/ld: warning can't open dynamic library:
libtestLib3Imp.dylib
referenced from: /.../ExportImport/Root/lib/libtestLib3lib.1.2.dylib
(checking for undefined symbols may be affected) (No such file or directory, errno = 2)
/usr/libexec/gcc/i686-apple-darwin8/4.0.1/ld: Undefined symbols: _testLib3Imp
referenced from libtestLib3lib expected to be defined in
libtestLib3Imp.dylib
or with CMAKE_SKIP_RPATH off to enable install_name in the Export side:
/usr/libexec/gcc/i686-apple-darwin8/4.0.1/ld: warning can't open dynamic library:
/Developer/SDKs/MacOSX10.4u.sdk/.../ExportImport/Export/impl/libtestLib3Imp.dylib
referenced from: /.../ExportImport/Export/libtestLib3lib.1.2.dylib
(checking for undefined symbols may be affected) (No such file or directory, errno = 2)
/usr/libexec/gcc/i686-apple-darwin8/4.0.1/ld: Undefined symbols:_testLib3Imp
referenced from libtestLib3lib expected to be defined in
/.../ExportImport/Export/impl/libtestLib3Imp.dylib
Note how "/Developer/SDKs/MacOSX10.4u.sdk" is prepended to the dependent
library path.
Commit 2cff26fa (Support linking to shared libs with dependent libs,
2008-01-31) and commit 82fcaebe (Pass dependent library search path to
linker on some platforms, 2008-02-01) worked around the problem by
defining platform variable CMAKE_LINK_DEPENDENT_LIBRARY_FILES. It tells
CMake to link to dependent libraries explicitly by their path thus
telling the linker where to find them.
Unfortunately the workaround had the side effect of linking dependent
libraries and defeats most benefits of LINK_INTERFACE_LIBRARIES.
Fortunately OS X 10.5 and above do not need to find transitive
dependencies at all so we can avoid the workaround on Modern OS X.
diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake
index c11c8fb..34eb3f4 100644
--- a/Modules/Platform/Darwin.cmake
+++ b/Modules/Platform/Darwin.cmake
@@ -187,11 +187,13 @@ IF(XCODE)
SET(CMAKE_INCLUDE_SYSTEM_FLAG_CXX)
ENDIF(XCODE)
-# Need to list dependent shared libraries on link line. When building
-# with -isysroot (for universal binaries), the linker always looks for
-# dependent libraries under the sysroot. Listing them on the link
-# line works around the problem.
-SET(CMAKE_LINK_DEPENDENT_LIBRARY_FILES 1)
+IF(_CURRENT_OSX_VERSION STREQUAL "10.4")
+ # Need to list dependent shared libraries on link line. When building
+ # with -isysroot (for universal binaries), the linker always looks for
+ # dependent libraries under the sysroot. Listing them on the link
+ # line works around the problem.
+ SET(CMAKE_LINK_DEPENDENT_LIBRARY_FILES 1)
+ENDIF()
SET(CMAKE_C_CREATE_SHARED_LIBRARY_FORBIDDEN_FLAGS -w)
SET(CMAKE_CXX_CREATE_SHARED_LIBRARY_FORBIDDEN_FLAGS -w)
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index f8ab686..4c7f221 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -161,7 +161,9 @@ listed on the command line.
- On Windows, DLLs are not directly linked, and the import libraries
have no transitive dependencies.
- - On Mac, we need to actually list the transitive dependencies.
+ - On Mac OS X 10.5 and above transitive dependencies are not needed.
+
+ - On Mac OS X 10.4 we need to actually list the transitive dependencies.
Otherwise when using -isysroot for universal binaries it cannot
find the dependent libraries. Listing them on the command line
tells the linker where to find them, but unfortunately also links
-----------------------------------------------------------------------
Summary of changes:
Modules/Platform/Darwin.cmake | 12 +++++++-----
Source/cmComputeLinkInformation.cxx | 4 +++-
2 files changed, 10 insertions(+), 6 deletions(-)
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list