> On 03/28/2011 02:51 PM, Rolf Eike Beer wrote: >> I try to do an INSTALL(EXPORT) to allow others to link against one of my >> libraries. That libraries is linked against some other internal >> libraries >> the target's don't need to link to as everything in them is purely >> internal. >> >> I tried something like that: >> >> ADD_LIBRARY(publiclib SHARED ${publiclib_SOURCES}) >> >> TARGET_LINK_LIBRARIES(publiclib privatelib) >> >> SET_TARGET_PROPERTIES(publiclib PROPERTIES LINK_INTERFACE_LIBRARIES "") >> >> INSTALL(TARGETS publiclib >> EXPORT publiclib_export >> RUNTIME DESTINATION bin >> LIBRARY DESTINATION lib >> ARCHIVE DESTINATION lib) >> >> INSTALL(EXPORT publiclib_export DESTINATION cmake/modules) >> >> This results in: >> >> Make Error: INSTALL(EXPORT "publiclib_export" ...) includes target >> "publiclib" which requires target "privatelib" that is not in the export >> set. >> >> Ehm, no, it doesn't? Is this intentional (why?), is there a workaround >> or should I file a bug report?
> That's got nothing to do with the LINK_INTERFACE_LIBRARIES property. > Your publiclib target is linked against the privatelib one, so you > can't place the former in an export set without the latter, and this > is what CMake tells you, cf. [1]. Remove the SET_TARGET_PROPERTIES() > command and you'll probably see that the error message persists, i.e. > LINK_INTERFACE_LIBRARIES can not be used to break any dependencies > established by TARGET_LINK_LIBRARIES(); it has other purposes [2]. The basic idea is: any symbols from those private libraries are, well, private. The user only ever sees the symbols from the public library. In fact he _can't_ even link to the private libraries on Windows as we never install the .lib files. And that's no problem at all as we already link to everything we need. I'm using --as-needed and --no-undefined on Un*x and see no problem there either. So the point is I want CMake to stop telling the user that he needs to those private libraries as that's simply not true. Eike _______________________________________________ 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