[cmake-developers] Apple tests for target_link_libraries failing
Brad King
brad.king at kitware.com
Wed Oct 12 08:09:00 EDT 2011
On 10/12/2011 2:22 AM, Stephen Kelly wrote:
> using set(CMAKE_LINK_INTERFACE_LIBRARIES "") should be the same as using
>
> target_link_libraries(libA LINK_INTERFACE_LIBRARIES "")
>
> for each library.
It is. The example under discussion has the same behavior even if you
explicitly set it on each target.
> It works for me, but I don't know why it doesn't work for you. Maybe Brad
> can have some insight?
The Modules/Platform/Darwin.cmake contains these lines:
# 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)
which were added here:
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2cff26fa#patch1
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=82fcaebe#patch4
The behavior we are seeing in the test on Apple can be changed to the
expected behavior by adding
SET(CMAKE_LINK_DEPENDENT_LIBRARY_FILES 0)
to the CMakeLists.txt file. However, I don't remember the details of why
I had to add that to Darwin.cmake in the first place. Hopefully there is
a better fix for the original problem.
-Brad
More information about the cmake-developers
mailing list