MantisBT - CMake | |||||
| View Issue Details | |||||
| ID | Project | Category | View Status | Date Submitted | Last Update |
| 0010444 | CMake | CMake | public | 2010-03-19 12:49 | 2010-03-25 19:20 |
| Reporter | Andrey Vihrov | ||||
| Assigned To | |||||
| Priority | normal | Severity | minor | Reproducibility | always |
| Status | closed | Resolution | no change required | ||
| Platform | OS | OS Version | |||
| Product Version | CMake-2-8 | ||||
| Target Version | Fixed in Version | ||||
| Summary | 0010444: Indirect shared library dependencies are added to the final executable | ||||
| Description | If target A depends on shared library B which itself is a CMake target, then A gets linked directly with libraries LIBS added for B with target_link_libraries (see example below). However, A neither uses LIBS directly, nor does it need them to link properly. Thus the current behavior adds extraneous and useless entries in A's dynamic section. | ||||
| Steps To Reproduce | |||||
| Additional Information | > cat CMakeLists.txt cmake_minimum_required (VERSION 2.8) add_library (lib SHARED lib.cpp) target_link_libraries (lib pthread) # pthread was randomly chosen add_executable (exe exe.cpp) target_link_libraries (exe lib) > make VERBOSE=1 /usr/bin/cmake -H/home/andrey/tmp/bug -B/home/andrey/tmp/bug --check-build-system CMakeFiles/Makefile.cmake 0 /usr/bin/cmake -E cmake_progress_start /home/andrey/tmp/bug/CMakeFiles /home/andrey/tmp/bug/CMakeFiles/progress.marks make -f CMakeFiles/Makefile2 all make[1]: Entering directory `/home/andrey/tmp/bug' make -f CMakeFiles/lib.dir/build.make CMakeFiles/lib.dir/depend make[2]: Entering directory `/home/andrey/tmp/bug' cd /home/andrey/tmp/bug && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/andrey/tmp/bug /home/andrey/tmp/bug /home/andrey/tmp/bug /home/andrey/tmp/bug /home/andrey/tmp/bug/CMakeFiles/lib.dir/DependInfo.cmake --color= make[2]: Leaving directory `/home/andrey/tmp/bug' make -f CMakeFiles/lib.dir/build.make CMakeFiles/lib.dir/build make[2]: Entering directory `/home/andrey/tmp/bug' /usr/bin/cmake -E cmake_progress_report /home/andrey/tmp/bug/CMakeFiles 2 [ 50%] Building CXX object CMakeFiles/lib.dir/lib.cpp.o /usr/bin/c++ -Dlib_EXPORTS -fPIC -o CMakeFiles/lib.dir/lib.cpp.o -c /home/andrey/tmp/bug/lib.cpp Linking CXX shared library liblib.so /usr/bin/cmake -E cmake_link_script CMakeFiles/lib.dir/link.txt --verbose=1 /usr/bin/c++ -fPIC -shared -Wl,-soname,liblib.so -o liblib.so CMakeFiles/lib.dir/lib.cpp.o -lpthread -------------------------------------------------------------------------------------------------^ As expected, "target_link_libraries (lib pthread)" specifies this make[2]: Leaving directory `/home/andrey/tmp/bug' /usr/bin/cmake -E cmake_progress_report /home/andrey/tmp/bug/CMakeFiles 2 [ 50%] Built target lib make -f CMakeFiles/exe.dir/build.make CMakeFiles/exe.dir/depend make[2]: Entering directory `/home/andrey/tmp/bug' cd /home/andrey/tmp/bug && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/andrey/tmp/bug /home/andrey/tmp/bug /home/andrey/tmp/bug /home/andrey/tmp/bug /home/andrey/tmp/bug/CMakeFiles/exe.dir/DependInfo.cmake --color= make[2]: Leaving directory `/home/andrey/tmp/bug' make -f CMakeFiles/exe.dir/build.make CMakeFiles/exe.dir/build make[2]: Entering directory `/home/andrey/tmp/bug' /usr/bin/cmake -E cmake_progress_report /home/andrey/tmp/bug/CMakeFiles 1 [100%] Building CXX object CMakeFiles/exe.dir/exe.cpp.o /usr/bin/c++ -o CMakeFiles/exe.dir/exe.cpp.o -c /home/andrey/tmp/bug/exe.cpp Linking CXX executable exe /usr/bin/cmake -E cmake_link_script CMakeFiles/exe.dir/link.txt --verbose=1 /usr/bin/c++ CMakeFiles/exe.dir/exe.cpp.o -o exe -rdynamic liblib.so -lpthread -Wl,-rpath,/home/andrey/tmp/bug ------------------------------------------------------------------------------^ Incorrect, target `exe' does not directly depend on libpthread make[2]: Leaving directory `/home/andrey/tmp/bug' /usr/bin/cmake -E cmake_progress_report /home/andrey/tmp/bug/CMakeFiles 1 [100%] Built target exe make[1]: Leaving directory `/home/andrey/tmp/bug' /usr/bin/cmake -E cmake_progress_start /home/andrey/tmp/bug/CMakeFiles 0 | ||||
| Tags | No tags attached. | ||||
| Relationships | |||||
| Attached Files | |||||
| Issue History | |||||
| Date Modified | Username | Field | Change | ||
| 2010-03-19 12:49 | Andrey Vihrov | New Issue | |||
| 2010-03-25 19:19 | Alex Neundorf | Note Added: 0020010 | |||
| 2010-03-25 19:20 | Alex Neundorf | Note Added: 0020011 | |||
| 2010-03-25 19:20 | Alex Neundorf | Status | new => closed | ||
| 2010-03-25 19:20 | Alex Neundorf | Resolution | open => no change required | ||
| Notes | |||||
|
|
|||||
|
|
||||
|
|
|||||
|
|
||||