[CMake] CMake removing duplicated static libraries from target_link_libraries list?

Marco marco.corvo at pd.infn.it
Wed Feb 2 09:04:22 EST 2011


Hi all,

I'm wondering, if I understood correctly the behaviour of CMake, whether 
there'a a way to prevent CMake from deleting duplicated libraries in a 
target_link_libraries list.

I have an executable which links against (all static) libraries A, B and 
C. A itself links against C,D,E... and so on. When CMake creates the 
link.txt file what I see is:

c++ -o myExe -lA -lC -lD -lE -lB

that is cmake links the executable against A followed by its dependents, 
then against B but not against C. The point is that B needs C to follow 
it as B depends on C. This is why I suspect that CMake removes the 
duplicated libraries listed in a target_link_libraries directive.

Is it correct? And is there a way to force CMake to preserve exactly the 
list of libraries passed to target_link_libraries?

Thanks.

Marco

-- 
Marco Corvo
SuperB experiment
CNRS - Orsay
c/o INFN - Padova


More information about the CMake mailing list