Howdy! I'm using 2.8.9 installed on MacOSX using macports, and am trying to get a minimal example of rpath working.
Doing it without cmake works fine; see http://kegel.com/macosx/rpath/demo.txt which just does gcc -shared foo.c -install_name @rpath/foo.so -o foo.so gcc -Wl,-rpath $OTHERDIR x.c foo.so and works fine. But doing it with cmake eludes me. Here's what I'm trying: http://kegel.com/macosx/rpath/demo2.txt http://kegel.com/macosx/rpath/CMakeLists.txt That CMakeLists.txt is just cmake_minimum_required(VERSION 2.8) set(MYLIBDIR "${CMAKE_SOURCE_DIR}/otherdir") add_library(foo SHARED foo.c) set_target_properties(foo PROPERTIES INSTALL_NAME_DIR "@rpath") add_executable(x x.c) set_target_properties( x PROPERTIES BUILD_WITH_INSTALL_RPATH 1 INSTALL_RPATH ${MYLIBDIR} ) target_link_libraries(x foo) When I run demo2.txt, it does /usr/bin/gcc -dynamiclib -Wl,-headerpad_max_install_names -o libfoo.dylib -install_name /Users/dank/rpath/btmp/libfoo.dylib CMakeFiles/foo.dir/foo.c.o /usr/bin/gcc -o CMakeFiles/x.dir/x.c.o -c /Users/dank/rpath/x.c /usr/bin/gcc -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/x.dir/x.c.o -o x libfoo.dylib and it appears to have totally ignored INSTALL_RPATH, so naturally running x fails with dyld: Library not loaded: /Users/dank/rpath/btmp/libfoo.dylib Can I buy a clue, please? -- 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://www.cmake.org/mailman/listinfo/cmake