[Qgis-developer] Library search paths on Linux/CMake

Magnus Homann magnus at homann.se
Mon Feb 19 15:46:27 EST 2007


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



More information about the Qgis-developer mailing list