KSpam wrote:
Bill,

Yes, where you create libA, you add this:

target_link_libraries(libA libB)

CMake will automatically chain.

Has this feature recently changed? I thought that adding "target_link_libraries(libA libB)" would explicitly link libB to libA. Often when I am static linking, I do not want to link any libraries to each other. I just want to be able to link all of the libraries to the final executable(s). Ideally, I would like the linking of libA to automatically pull in the linking of libB when building exeC.

For static libraries the target_link_libraries will be ignored. So, it is safe to do in all cases. In fact for static links it makes things work much better, because it can keep the order of the static libraries correct. There is not a cross platform way to suck a static library into another static library.

From your example, this is what I think happens:
1) libB is linked to libA
2) libA is linked to exeC

This is what I want to do:
1) libA and libB are linked to exeC

The example is this:
add_library(libB)
add_library(libA)
target_link_libraries(libA libB)
add_executable(excC)
target_link_librareis(excC libA)

This will result in this link:
excC -> libA and libB


-Bill
_______________________________________________
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to