[CMake] Dynamic linking doesn't work after install

Marcus D. Hanwell marcus.hanwell at kitware.com
Fri Apr 22 09:54:47 EDT 2011


On Fri, Apr 22, 2011 at 9:48 AM, David Doria <daviddoria at gmail.com> wrote:
> I have created an executable like this:
>
>  add_executable(ImageCompleter ${AppSources})
>  target_link_libraries(ImageCompleter ${LibrariesAlwaysUsed})
>
>  INSTALL( TARGETS ImageCompleter
>    RUNTIME DESTINATION ${INSTALL_DIR} )
>
> When I run the one that is created with 'make', it works fine.
> However, when I run the one that is copied by 'make install' I get:
>
> error while loading shared libraries: I get
> libwx_gtk2u_core-2.9.so.1: cannot open shared object file: No such
> file or directory
>
> It looks like this problem:
> http://www.cmake.org/pipermail/cmake/2010-July/038213.html
> but that link doesn't offer a solution.
>
> When I install it says
> -- Installing: /home/doriad/bin/Research/ImageCompleter
> -- Removed runtime path from "/home/doriad/bin/Research/ImageCompleter"
>
> I'm assuming that "removed runtime path" is the problem? How do I stop
> that from happening?
>
I think the CMake page on RPATHs might be what you are looking for.

http://www.cmake.org/Wiki/CMake_RPATH_handling

Marcus


More information about the CMake mailing list