[Qgis-developer] Library search paths on Linux/CMake
Tim Sutton
tim at linfiniti.com
Mon Feb 19 16:35:04 EST 2007
Hi
I recently changed the search path (in qgsaplication.cpp) for
resources (share, lib/qgis etc) to be relative by default and if not
found there to fall back to the prefix specified during cmake. The
reason I did this is that for the linux bundle I have been working on
the user needs to be able to install the bundle to any location and
run it. Also on mac the aplication needs to be relocateable. Is it
possible with RPATH to use a relative path for libs rather than an
absolute one? For mac I think we can reset the paths using otool
anyway. For linux bundle the launcher script sets LD_LIBRARY_PATH
prior to starting the app. So if LD_LIBRARY_PATH is still used even
with your change below I guess it should not cause any problems...
I will test a bit here on mac and see what happens after aplying your
patch and then e.g. renaming qgis.app
Regards
Tim
2007/2/19, Magnus Homann <magnus at homann.se>:
> The best way to set paths to libraries on Unix is using LD_LIBARY_PATH
> (when installed in non-standard place).
>
> CMake gives another option, writing compile time search paths into the
> binaries (and libraries). I have a small patch that includes paths both
> for libqgis_core and for any other library in a non-standard place that
> is used in compiling.
>
> I'm not sure which is the proper way to do this, so I wont commit it.
>
> The 'old' behaviour can be had by setting 'CMAKE_SKIP_RPATH' (adv.
> option) to on in ccmake.
>
> Above according to my tests with 0.8.
>
>
> Index: src/gui/CMakeLists.txt
> ===================================================================
> --- src/gui/CMakeLists.txt (revision 6632)
> +++ src/gui/CMakeLists.txt (arbetskopia)
> @@ -35,6 +35,11 @@
>
> ADD_EXECUTABLE(qgis ${QGIS_APP_SRCS})
>
> +SET_TARGET_PROPERTIES(qgis PROPERTIES
> + INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib
> + INSTALL_RPATH_USE_LINK_PATH true
> +)
> +
> TARGET_LINK_LIBRARIES(qgis
> ${QT_LIBRARIES}
> qgis_core
>
> --
> Magnus Homann
> magnus at homann.se
> +46 702 399 558
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.qgis.org
> http://lists.qgis.org/cgi-bin/mailman/listinfo/qgis-developer
>
--
--
Tim Sutton
Visit http://qgis.org for a great Open Source GIS
Home Page: http://linfiniti.com
Skype: timlinux
MSN: tim_bdworld at msn.com
Yahoo: tim_bdworld at yahoo.com
Jabber: timlinux
Irc: timlinux on #qgis at freenode.net
More information about the Qgis-developer
mailing list