On 03/30/2011 02:02 PM, Rolf Eike Beer wrote: >> However, I still don't understand the relation of that transitive >> linking and its avoidance, respectively, to your initial complaint >> about CMake's error message due to the missing library in another >> library's export set. Unless I'm mistaken, you've a shared library >> target "publiclib" which is linked explicitly against another target >> "privatelib" via TARGET_LINK_LIBRARIES(). > > Yes. > >> This means you can't place >> publiclib in an export set without privatelib since the former could >> not be set up properly w.r.t. its diverse IMPORTED properties if the >> latter is not installed, too, i.e. INSTALL(EXPORT) could not generate >> a valid export file. > > Yes, and that's basically the problem I have. > > Ok, I went and put every thing in the same export set. Which itself is a > bit weird as I now have to INSTALL static libraries that were linked by > the shared ones only to be able to specify that they are in the export > set. And at the end all those libraries of course show up in the export. > And I still see IMPORTED_LINK_DEPENDENT_LIBRARIES_DEBUG of the library > that this is all about set to it's dependencies.
W.r.t. *static* libraries, that's not necessary: If a shared library is linked against a static one and the former prevents transitive linking for the latter by setting LINK_INTERRFACE_LIBRARIES appropriately, the static library does not need to be put in the shared one's export set: CMAKE_MINIMUM_REQUIRED(VERSION 2.8 FATAL_ERROR) PROJECT(PRIVATE C) SET(CMAKE_VERBOSE_MAKEFILE ON) FILE(WRITE ${CMAKE_BINARY_DIR}/f.c "void f(void){}\n") ADD_LIBRARY(f STATIC f.c) FILE(WRITE ${CMAKE_BINARY_DIR}/g.c "void g(void){f();}\n") ADD_LIBRARY(g SHARED g.c) TARGET_LINK_LIBRARIES(g f) SET_TARGET_PROPERTIES(g PROPERTIES LINK_INTERFACE_LIBRARIES "") INSTALL(TARGETS g EXPORT public LIBRARY DESTINATION lib) INSTALL(EXPORT public DESTINATION share) In the export file, the static f isn't mentioned at all, and that's perfect. Without LINK_INTERFACE_LIBRARIES set or with a *shared* f, this does not work, of course. Regards, Michael _______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake