[CMake] Marking a library dependency from within a library.

KSpam keesling_spam at cox.net
Thu Oct 18 15:11:22 EDT 2007


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.

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

Am I misunderstanding the target_link_libraries command?

Thanks,
Justin


More information about the CMake mailing list