hi andreas, >> common/libcommon.so >> target1/target1 >> target2/target2 >> >> both target1 and target2 are linked with libcommon, both work fine in the >> build directory, the libraries are resolved correctly. >> >> after installing them, they are formatted like: >> $PREFIX/lib/libcommon.so >> $PREFIX/bin/target1 >> $PREFIX/bin/target2 >> >> now libcommon.so cannot be resolved, probably because the targets are >> linked with ../common/libcommon.so, so the loader cannot find the shared >> library. what is the best way to resolve this issue? > > How did you write your cmake file? Usually you'd be using the libcommon > target name in target_link_libraries for target1 and target2.
in common/ i build libcommon add_library(libcommon SHARED ...) in the target directories, i build the target: add_executable(targetX ...) target_link_libraries(targetX libcommon) the targets are built with -rdynamic -L../common ../common/libcommon.so Wl,- rpath,../common:/path/to/common from my limited understanding of the linking process, it should link with -lcommon instead of using ../common/libcommon.so, since the rpath is already set to ../common. but how can i tell cmake to do this? > Additionally > in newer CMake versions cmake will set the RPATH of the target1/target2 > binaries to point to the directory and changes this RPATH when installing > everything. Hence the loader should find your library. i am not completely fluent, how the linking process works. the rpath seems to be set correctly, though. just the library is passed with a path relative to the targets ... thanks, tim -- t...@klingt.org http://tim.klingt.org I don't write music for sissy ears. Charles Ives _______________________________________________ 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