View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0013211CMakeCMakepublic2012-05-10 21:362012-10-01 13:22
Reporterthanil 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionno change required 
PlatformApple MacOSMac OS XOS Version10.7.3
Product VersionCMake 2.8.8 
Target VersionFixed in Version 
Summary0013211: CMake should not link shared libraries recursively
DescriptionIf target A depends on a shared library B and B depends on a shared library C, then CMake will create linker directives to link A to both B and C, when it should only link A to B. This creates unnecessary dependencies in the case of shared libraries.
Steps To ReproduceAttached file contains example CMake project with an executable A and two shared libraries B and C.
Once cmake has been run from directory xxx
xxx/CMakeFiles/a.dir/link.txt contains the following line:

/usr/bin/gcc -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/a.dir/a.c.o -o a b/liblibb.dylib b/c/liblibc.dylib

which shows that A will be linked to C when there is no reason to do so since these are shared libraries.
TagsNo tags attached.
Attached Filesgz file icon cmake_link_bug.tar.gz [^] (1,399 bytes) 2012-05-10 21:36

 Relationships

  Notes
(0029466)
Mathieu Malaterre (developer)
2012-05-11 02:42

When all else failed, read the instructions:

$ cmake --help-property LINK_INTERFACE_LIBRARIES
cmake version 2.8.7
  LINK_INTERFACE_LIBRARIES
       List public interface libraries for a shared library or executable.

       By default linking to a shared library target transitively links to
       targets with which the library itself was linked. For an executable
       with exports (see the ENABLE_EXPORTS property) no default transitive
       link dependencies are used. This property replaces the default
       transitive link dependencies with an explicit list. When the target
       is linked into another target the libraries listed (and recursively
       their link interface libraries) will be provided to the other target
       also. If the list is empty then no transitive link dependencies will
       be incorporated when this target is linked into another target even if
       the default set is non-empty. This property is initialized by the
       value of the variable CMAKE_LINK_INTERFACE_LIBRARIES if it is set when
       a target is created. This property is ignored for STATIC libraries.
(0031126)
David Cole (manager)
2012-10-01 13:22

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2012-05-10 21:36 thanil New Issue
2012-05-10 21:36 thanil File Added: cmake_link_bug.tar.gz
2012-05-11 02:42 Mathieu Malaterre Note Added: 0029466
2012-05-11 07:53 Brad King Status new => resolved
2012-05-11 07:53 Brad King Resolution open => no change required
2012-10-01 13:22 David Cole Note Added: 0031126
2012-10-01 13:22 David Cole Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team