I thought CMake knew how to not drag all the dependent libraries once you linked an executable module.<br><br>add_library(A STATIC a.cpp)<br>add_library(B SHARED b.cpp)<br>target_link_libraries(B A)<br>add_library(C SHARED c.cpp)<br>

target_link_libraries(C B)<br><br>add_executable(run run.cpp)<br>target_link_libraries(run C)<br><br>At this point I&#39;m seeing that C links against B and A when I think it should only link against B since A shouldn&#39;t be needed to link against B.  In addition when compiling run, it links against B and A.<br>

<br>/usr/bin/c++   -dynamiclib -Wl,-headerpad_max_install_names   -o libC.dylib -install_name /Users/jbigler/tmp/code/cmake/translinking/build/libC.dylib CMakeFiles/C.dir/c.cpp.o libB.dylib libA.a<br>/usr/bin/c++    -Wl,-search_paths_first -Wl,-headerpad_max_install_names   CMakeFiles/run.dir/run.cpp.o  -o run  libC.dylib libB.dylib libA.a <br>

<br>Is this the expected behavior?  I&#39;m seeing this with CMake 2.8.5 on Mac.<br><br>Project attached.<br><br>Thanks,<br>James<br>