[Liblas-devel] CMake patches for building liblas under Linux Fedora 15

Charles Karney charles.karney at sri.com
Wed Sep 21 16:11:56 EDT 2011


I have a Linux Fedora 15 system with {gdal,libgeotiff}{,-devel}
installed via yum.  I am building liblas 1.7.0b2 with

    cmake -D WITH_GDAL=on -D WITH_GEOTIFF=on

and I needed to apply the following patches so that gdal and libgeotiff
are found (in the case of libgeotiff) and configured (in the case of
gdal) correctly.  Also I set INSTALL_RPATH so that the run-time library
path is included in the utilities.

I have only tested these patches on my Linux system.

--- apps/CMakeLists.txt.orig	2011-09-21 15:44:11.000000000 -0400
+++ apps/CMakeLists.txt	2011-09-21 15:47:16.000000000 -0400
@@ -162,6 +162,11 @@
       target_link_libraries(${LAS2OCI} ${APPS_CPP_DEPENDENCIES}
${ORACLE_LIBRARY} )
   endif()

+if(UNIX)
+    set_target_properties (${LIBLAS_UTILITIES} PROPERTIES
+        INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib)
+endif(UNIX)
+
   if(BIGFILE_TEST)
       add_executable(${BIGFILE_TEST} bigtest.c)
       target_link_libraries(${BIGFILE_TEST} ${LIBLAS_C_LIB_NAME})
--- cmake/modules/FindGeoTIFF.cmake.orig	2011-07-01 14:59:53.000000000 -0400
+++ cmake/modules/FindGeoTIFF.cmake	2011-09-21 15:17:37.000000000 -0400
@@ -38,7 +38,7 @@

   FIND_PATH(GEOTIFF_INCLUDE_DIR
     geotiff.h
-  PATH_PREFIXES geotiff
+  PATH_SUFFIXES geotiff libgeotiff
     PATHS
     ${OSGEO4W_ROOT_DIR}/include)

--- cmake/modules/FindGDAL.cmake.orig	2011-07-01 14:59:53.000000000 -0400
+++ cmake/modules/FindGDAL.cmake	2011-09-21 15:36:45.000000000 -0400
@@ -131,7 +131,7 @@

           FIND_PATH(GDAL_INCLUDE_DIR
               gdal.h
-            PATH_PREFIXES gdal gdal-1.6
+            PATH_SUFFIXES gdal gdal-1.6
               PATHS
               ${GDAL_PREFIX}/include/gdal
               ${GDAL_PREFIX}/include
@@ -163,6 +163,13 @@
               STRING(REGEX REPLACE "[-][l]" "" GDAL_LIB_NAME
${GDAL_LIB_NAME_WITH_PREFIX})
           ENDIF()

+	if(NOT GDAL_LINK_DIRECTORIES)
+	    FIND_PATH(GDAL_LINK_DIRECTORIES
+		lib${GDAL_LIB_NAME}.so
+		PATHS
+		/usr/lib /usr/lib64 /usr/local/lib)
+	endif(NOT GDAL_LINK_DIRECTORIES)
+
           IF(APPLE)
               SET(GDAL_LIBRARY
${GDAL_LINK_DIRECTORIES}/lib${GDAL_LIB_NAME}.dylib CACHE STRING INTERNAL)
           ELSE()


More information about the Liblas-devel mailing list