[cmake-developers] [CMake 0015034]: target_link_libraries omits some dependencies
Mantis Bug Tracker
mantis at public.kitware.com
Wed Jul 23 04:56:11 EDT 2014
The following issue has been SUBMITTED.
======================================================================
http://www.cmake.org/Bug/view.php?id=15034
======================================================================
Reported By: Glenn Coombs
Assigned To:
======================================================================
Project: CMake
Issue ID: 15034
Category: CMake
Reproducibility: always
Severity: minor
Priority: normal
Status: new
======================================================================
Date Submitted: 2014-07-23 04:56 EDT
Last Modified: 2014-07-23 04:56 EDT
======================================================================
Summary: target_link_libraries omits some dependencies
Description:
The target_link_libraries command fails to add the specified linker option under
some conditions.
Steps to Reproduce:
Save the example CMakeLists.txt file attached to this ticket and then run these
commands:
mkdir build
cd build
cmake ..
make VERBOSE=yes
The link command generated for my_lib_shared is as follows:
gcc -fPIC -shared -Wl,-soname,libmy_lib_shared.so
-o libmy_lib_shared.so CMakeFiles/my_lib_shared.dir/my_lib_shared.c.o
libsome_lib_1.a
-Wl,-whole-archive libsome_lib_3.a -Wl,-no-whole-archive
libsome_lib_2.a
-Wl,-whole-archive libsome_lib_4.a
libsome_lib_5.a
which is incorrect. The lib4 line should include a -no-whole-archive option on
the end. If you comment line 25 and uncomment line 26 in the CMakeLists.txt
then the correct output is generated:
gcc -fPIC -shared -Wl,-soname,libmy_lib_shared.so -o
libmy_lib_shared.so CMakeFiles/my_lib_shared.dir/my_lib_shared.c.o
libsome_lib_1.a
-Wl,-whole-archive libsome_lib_3.a -Wl,-no-whole-archive
libsome_lib_2.a
-Wl,-whole-archive libsome_lib_4.a -Wl,-Qy,-no-whole-archive
libsome_lib_5.a
For some reason the -no-whole-archive is omitted unless another option precedes
it.
======================================================================
Issue History
Date Modified Username Field Change
======================================================================
2014-07-23 04:56 Glenn Coombs New Issue
2014-07-23 04:56 Glenn Coombs File Added: CMakeLists.txt
======================================================================
More information about the cmake-developers
mailing list