Hello there. First of all is there any documentation about how CMake handles deduplication of libraries when linking (so to avoid duplicate libraries to be linked unnecessarily)?
Now to my issue: I have a library libA which has to link to libB, libC, libD and libE. libA is the only one internal to the CMake buildsystem, the other ones are all external, and all are shared libs. i obtain libB, libC and libD by path (find_package) and libE is an imported target (added with add_library(libE SHARED IMPORTED)). libE is actually compiled through custom commands and have dependencies that i've set with set_target_properties(libE PROPERTIES INTERFACE_LINK_LIBRARIES "${LIBRARY_DEPS}"). The deps are libC, libD, libF, libG and they're set with set(LIBRARY_DEPS ${LIBC} ${LIBD} ${LIBF} ${LIBG}). Now if i look at the libA link command line, i see libC and libD duplicated. The libs libA needs are linked with target_link_libraries and, except for libE which is a target, they are all specified as absolute paths. Now i've also tried removing the quotes around ${LIBRARY_DEPS}, when using it, but this time while it deduplicates libC and libD, libF and libG aren't linked anymore... I've also tried creating imported targets for libC and libD, using them in libA target_link_libraries (while still specifing the absolute path for INTERFACE_LINK_LIBRARIES of libE), but it still doesn't deduplicate them. Any clue?
-- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake