2012/1/19 Anthony Todisco <todisco.anthony...@gmail.com>: > Thank you Eric for this link, but I don't really understand how to use RPATH > with CMake.
The RPATH usage control with CMake is done using 4 variables: CMAKE_SKIP_BUILD_RPATH CMAKE_BUILD_WITH_INSTALL_RPATH CMAKE_INSTALL_RPATH CMAKE_INSTALL_RPATH_USE_LINK_PATH you can get the document of each of those vars with cmake --help-variable <VarName> > Could you provide me piece of advice for my case? RPATH is a Unix way to put inside a binary executable an explicit link to the libraries on which this executable depends. In your case the "Manager" executable depends on the "BaseLib, ComposeLib and phtread" as stated by your target_link_libraries( Manager BaseLib ComposeLib pthread ) when you run "Manager" the system thus need to load the BaseLib, ComposeLib and phtread libs. phtread is [probably] found automatically because it is installed system-wide and I won't explain that. BaseLib and ComposeLib are built in your project. CMake knows all of this, then: in the build tree it uses RPATH in order to make Manager run easily without fiddling with LD_LIBRARY_PATH. At the install location (/usr/local/... in your case) CMake does not setup RPATH inside the **installed** executable unless you tell him to do so, by specifying the install rpath: SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") from "http://www.cmake.org/Wiki/CMake_RPATH_handling" you can read "when installing all executables and shared libraries will be relinked, so they will find all libraries they need" by the way you should NOT do that: #Define link libraries folder link_directories(../../Bin/${BUILD_PATH}) this should not be necessary, see: cmake --help-command link_directories -- Erk Membre de l'April - « promouvoir et défendre le logiciel libre » - http://www.april.org -- 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