Changeset 1292:ee7febfbdac6
- Timestamp:
- 09/26/09 18:18:46 (10 months ago)
- Branch:
- default
- Files:
-
- 4 edited
-
CMakeLists.txt (modified) (2 diffs)
-
build/cmake/FindGDAL.cmake (modified) (2 diffs)
-
build/cmake/FindGeoTIFF.cmake (modified) (2 diffs)
-
src/CMakeLists.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
CMakeLists.txt
r1290 r1292 1 # $Id$ 1 ############################################################################### 2 # Main CMake configuration file for libLAS 2 3 # 3 # Top-level CMakeList.txt for libLAS4 # Author: Mateusz Loskot <mateusz@loskot.net> 4 5 # 5 6 # ************************************************************************ … … 7 8 # ************************************************************************ 8 9 # 9 PROJECT( libLAS ) 10 ############################################################################### 11 # libLAS general settings 12 PROJECT(libLAS) 10 13 11 SET( LIBLAS_LIB_NAME las ) 12 SET( LIBLAS_C_LIB_NAME las_c)14 # Name of C++ library 15 SET(LIBLAS_LIB_NAME las) 13 16 14 ############################################################# 17 # Name of C library 18 SET(LIBLAS_C_LIB_NAME las_c) 19 20 # Choose package components 21 SET(WITH_UTILITIES TRUE CACHE BOOL "Choose if libLAS utilities should be built") 22 SET(WITH_TESTS FALSE CACHE BOOL "Choose if libLAS unit tests should be built") 23 24 ############################################################################### 15 25 # CMake settings 16 17 26 CMAKE_MINIMUM_REQUIRED( VERSION 2.4.0 ) 18 27 19 SET( CMAKE_COLOR_MAKEFILE ON)28 SET(CMAKE_COLOR_MAKEFILE ON) 20 29 21 30 # Path to additional CMake modules 22 31 SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/build/cmake ${CMAKE_MODULE_PATH}) 23 32 24 25 ############################################################# 26 # Building general settings 33 ############################################################################### 34 # Build type settings 27 35 28 36 IF(NOT CMAKE_BUILD_TYPE) 29 SET(CMAKE_BUILD_TYPE Debug CACHE STRING30 "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."31 FORCE)32 ENDIF( NOT CMAKE_BUILD_TYPE)37 SET(CMAKE_BUILD_TYPE Debug CACHE STRING 38 "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel" 39 FORCE) 40 ENDIF() 33 41 34 ############################################################# 42 SET(BUILD_PEDANTIC TRUE CACHE BOOL "Choose compilation in pedantic or relaxed mode") 43 44 ############################################################################### 35 45 # Platform and compiler specific settings 36 46 37 IF (WIN32) 38 ADD_DEFINITIONS( /W4 ) 47 IF(WIN32) 48 IF (MSVC) 49 IF(BUILD_PEDANTIC) 50 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4") 51 ENDIF() 39 52 40 IF (MSVC)41 53 IF (MSVC80) 42 ADD_DEFINITIONS( /D_CRT_SECURE_NO_WARNINGS ) 43 ADD_DEFINITIONS( /D_CRT_NONSTDC_NO_WARNING ) 44 ENDIF (MSVC80) 45 ENDIF (MSVC) 46 ELSE (WIN32) 54 ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS) 55 ADD_DEFINITIONS(-D_CRT_NONSTDC_NO_WARNING) 56 ENDIF() 57 ENDIF() 58 ELSE() 59 IF(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) 60 61 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -Wall -Wno-long-long -ansi") 47 62 48 IF (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) 49 ADD_DEFINITIONS( -Wall -Wno-long-long -pedantic -ansi -fPIC ) 63 IF(BUILD_PEDANTIC) 64 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic") 65 ENDIF() 66 67 IF (CMAKE_COMPILER_IS_GNUCXX) 68 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++98") 69 ENDIF() 70 ENDIF() 71 ENDIF(WIN32) 50 72 51 IF (CMAKE_COMPILER_IS_GNUCXX) 52 SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++98" ) 53 ENDIF (CMAKE_COMPILER_IS_GNUCXX) 54 ENDIF (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) 55 ENDIF (WIN32) 56 57 ############################################################# 73 ############################################################################### 58 74 # Search for dependencies 59 75 60 FIND_PACKAGE(GDAL) 61 IF (GDAL_FOUND) 62 ADD_DEFINITIONS( -D HAVE_GDAL ) 63 ENDIF (GDAL_FOUND) 76 # zlib support - optional, default=OFF 77 SET(WITH_ZLIB FALSE CACHE BOOL "Choose if zlib support should be built") 64 78 65 # GeoTIFF support (optional) 66 FIND_PACKAGE(GeoTIFF) 67 IF (GEOTIFF_FOUND) 68 #TODO: Use to generate config.h 69 #SET (HAVE_LIBGEOTIFF TRUE) 70 ADD_DEFINITIONS( -D HAVE_LIBGEOTIFF ) 71 ENDIF (GEOTIFF_FOUND) 79 IF(WITH_ZLIB) 80 FIND_PACKAGE(ZLIB) 72 81 73 ############################################################# 82 IF(ZLIB_FOUND) 83 ADD_DEFINITIONS(-DHAVE_ZLIB) 84 ENDIF() 85 ENDIF() 86 87 # GDAL/OGR support - optional, default=OFF 88 SET(WITH_GDAL FALSE CACHE BOOL "Choose if GDAL support should be built") 89 90 IF(WITH_GDAL) 91 FIND_PACKAGE(GDAL 1.6.0) 92 93 IF (GDAL_FOUND) 94 ADD_DEFINITIONS(-DHAVE_GDAL) 95 ENDIF() 96 ENDIF() 97 98 # GeoTIFF support - optional, default=OFF 99 SET(WITH_GEOTIFF FALSE CACHE BOOL "Choose if GeoTIFF support should be built") 100 101 IF(WITH_GEOTIFF) 102 FIND_PACKAGE(GeoTIFF 1.2.5) 103 104 IF(GEOTIFF_FOUND) 105 ADD_DEFINITIONS(-DHAVE_LIBGEOTIFF) 106 ENDIF() 107 ENDIF() 108 109 # Spatial Index support - optional, default=OFF 110 # TODO 111 112 # Oracle support - optional, default=OFF 113 # TODO 114 115 # Boost C++ Libraries support - optional, default=OFF 116 # TODO 117 118 ############################################################################### 74 119 # List of directories to process 75 120 76 SUBDIRS( 77 include 78 src 79 apps 80 test 81 ) 121 ADD_SUBDIRECTORY(src) 122 123 IF(WITH_UTILITIES) 124 ADD_SUBDIRECTORY(apps) 125 ENDIF() 126 127 IF(WITH_TESTS) 128 ADD_SUBDIRECTORY(test) 129 ENDIF() 130 131 ############################################################################### 132 # Output configuration summary 82 133 83 134 84 85 IF (XXX_FOUND)86 87 ########## THE HUGE BLOCK BELOW IS TO LEARN CMAKE AND WILL BE REMOVED ###############88 # ------------------------- Begin Generic CMake Variable Logging ------------------89 MESSAGE( STATUS "=============== BEGIN TEST VARIABLES LOGGING OUTPUT =============" )90 91 # if you are building in-source, this is the same as CMAKE_SOURCE_DIR, otherwise92 # this is the top level directory of your build tree93 MESSAGE( STATUS "CMAKE_BINARY_DIR: " ${CMAKE_BINARY_DIR} )94 95 # if you are building in-source, this is the same as CMAKE_CURRENT_SOURCE_DIR, otherwise this96 # is the directory where the compiled or generated files from the current CMakeLists.txt will go to97 MESSAGE( STATUS "CMAKE_CURRENT_BINARY_DIR: " ${CMAKE_CURRENT_BINARY_DIR} )98 99 # this is the directory, from which cmake was started, i.e. the top level source directory100 MESSAGE( STATUS "CMAKE_SOURCE_DIR: " ${CMAKE_SOURCE_DIR} )101 102 # this is the directory where the currently processed CMakeLists.txt is located in103 MESSAGE( STATUS "CMAKE_CURRENT_SOURCE_DIR: " ${CMAKE_CURRENT_SOURCE_DIR} )104 105 # contains the full path to the top level directory of your build tree106 MESSAGE( STATUS "PROJECT_BINARY_DIR: " ${PROJECT_BINARY_DIR} )107 108 # contains the full path to the root of your project source directory,109 # i.e. to the nearest directory where CMakeLists.txt contains the PROJECT() command110 MESSAGE( STATUS "PROJECT_SOURCE_DIR: " ${PROJECT_SOURCE_DIR} )111 112 # set this variable to specify a common place where CMake should put all executable files113 # (instead of CMAKE_CURRENT_BINARY_DIR)114 MESSAGE( STATUS "EXECUTABLE_OUTPUT_PATH: " ${EXECUTABLE_OUTPUT_PATH} )115 116 # set this variable to specify a common place where CMake should put all libraries117 # (instead of CMAKE_CURRENT_BINARY_DIR)118 MESSAGE( STATUS "LIBRARY_OUTPUT_PATH: " ${LIBRARY_OUTPUT_PATH} )119 120 # tell CMake to search first in directories listed in CMAKE_MODULE_PATH121 # when you use FIND_PACKAGE() or INCLUDE()122 MESSAGE( STATUS "CMAKE_MODULE_PATH: " ${CMAKE_MODULE_PATH} )123 124 # this is the complete path of the cmake which runs currently (e.g. /usr/local/bin/cmake)125 MESSAGE( STATUS "CMAKE_COMMAND: " ${CMAKE_COMMAND} )126 127 # this is the CMake installation directory128 MESSAGE( STATUS "CMAKE_ROOT: " ${CMAKE_ROOT} )129 130 # this is the filename including the complete path of the file where this variable is used.131 MESSAGE( STATUS "CMAKE_CURRENT_LIST_FILE: " ${CMAKE_CURRENT_LIST_FILE} )132 133 # this is linenumber where the variable is used134 MESSAGE( STATUS "CMAKE_CURRENT_LIST_LINE: " ${CMAKE_CURRENT_LIST_LINE} )135 136 # this is used when searching for include files e.g. using the FIND_PATH() command.137 MESSAGE( STATUS "CMAKE_INCLUDE_PATH: " ${CMAKE_INCLUDE_PATH} )138 139 # this is used when searching for libraries e.g. using the FIND_LIBRARY() command.140 MESSAGE( STATUS "CMAKE_LIBRARY_PATH: " ${CMAKE_LIBRARY_PATH} )141 142 # the complete system name, e.g. "Linux-2.4.22", "FreeBSD-5.4-RELEASE" or "Windows 5.1"143 MESSAGE( STATUS "CMAKE_SYSTEM: " ${CMAKE_SYSTEM} )144 145 # the short system name, e.g. "Linux", "FreeBSD" or "Windows"146 MESSAGE( STATUS "CMAKE_SYSTEM_NAME: " ${CMAKE_SYSTEM_NAME} )147 148 # only the version part of CMAKE_SYSTEM149 MESSAGE( STATUS "CMAKE_SYSTEM_VERSION: " ${CMAKE_SYSTEM_VERSION} )150 151 # the processor name (e.g. "Intel(R) Pentium(R) M processor 2.00GHz")152 MESSAGE( STATUS "CMAKE_SYSTEM_PROCESSOR: " ${CMAKE_SYSTEM_PROCESSOR} )153 154 # is TRUE on all UNIX-like OS's, including Apple OS X and CygWin155 MESSAGE( STATUS "UNIX: " ${UNIX} )156 157 # is TRUE on Windows, including CygWin158 MESSAGE( STATUS "WIN32: " ${WIN32} )159 160 # is TRUE on Apple OS X161 MESSAGE( STATUS "APPLE: " ${APPLE} )162 163 # is TRUE when using the MinGW compiler in Windows164 MESSAGE( STATUS "MINGW: " ${MINGW} )165 166 # is TRUE on Windows when using the CygWin version of cmake167 MESSAGE( STATUS "CYGWIN: " ${CYGWIN} )168 169 # is TRUE on Windows when using a Borland compiler170 MESSAGE( STATUS "BORLAND: " ${BORLAND} )171 172 # Microsoft compiler173 MESSAGE( STATUS "MSVC: " ${MSVC} )174 MESSAGE( STATUS "MSVC_IDE: " ${MSVC_IDE} )175 MESSAGE( STATUS "MSVC60: " ${MSVC60} )176 MESSAGE( STATUS "MSVC70: " ${MSVC70} )177 MESSAGE( STATUS "MSVC71: " ${MSVC71} )178 MESSAGE( STATUS "MSVC80: " ${MSVC80} )179 MESSAGE( STATUS "CMAKE_COMPILER_2005: " ${CMAKE_COMPILER_2005} )180 181 # set this to true if you don't want to rebuild the object files if the rules have changed,182 # but not the actual source files or headers (e.g. if you changed the some compiler switches)183 MESSAGE( STATUS "CMAKE_SKIP_RULE_DEPENDENCY: " ${CMAKE_SKIP_RULE_DEPENDENCY} )184 185 # since CMake 2.1 the install rule depends on all, i.e. everything will be built before installing.186 # If you don't like this, set this one to true.187 MESSAGE( STATUS "CMAKE_SKIP_INSTALL_ALL_DEPENDENCY: " ${CMAKE_SKIP_INSTALL_ALL_DEPENDENCY} )188 189 # If set, runtime paths are not added when using shared libraries. Default it is set to OFF190 MESSAGE( STATUS "CMAKE_SKIP_RPATH: " ${CMAKE_SKIP_RPATH} )191 192 # set this to true if you are using makefiles and want to see the full compile and link193 # commands instead of only the shortened ones194 MESSAGE( STATUS "CMAKE_VERBOSE_MAKEFILE: " ${CMAKE_VERBOSE_MAKEFILE} )195 196 # this will cause CMake to not put in the rules that re-run CMake. This might be useful if197 # you want to use the generated build files on another machine.198 MESSAGE( STATUS "CMAKE_SUPPRESS_REGENERATION: " ${CMAKE_SUPPRESS_REGENERATION} )199 200 # Choose the type of build. Example: SET(CMAKE_BUILD_TYPE Debug)201 MESSAGE( STATUS "CMAKE_BUILD_TYPE: " ${CMAKE_BUILD_TYPE} )202 203 # A simple way to get switches to the compiler is to use ADD_DEFINITIONS().204 # But there are also two variables exactly for this purpose:205 206 # the compiler flags for compiling C sources207 MESSAGE( STATUS "CMAKE_C_FLAGS: " ${CMAKE_C_FLAGS} )208 MESSAGE( STATUS "CMAKE_C_FLAGS_RELEASE: " ${CMAKE_C_FLAGS_RELEASE} )209 MESSAGE( STATUS "CMAKE_C_FLAGS_DEBUG: " ${CMAKE_C_FLAGS_DEBUG} )210 211 # the compiler flags for compiling C++ sources212 MESSAGE( STATUS "CMAKE_CXX_FLAGS: " ${CMAKE_CXX_FLAGS} )213 MESSAGE( STATUS "CMAKE_CXX_FLAGS_RELEASE: " ${CMAKE_CXX_FLAGS_RELEASE} )214 MESSAGE( STATUS "CMAKE_CXX_FLAGS_DEBUG: " ${CMAKE_CXX_FLAGS_DEBUG} )215 216 # if this is set to ON, then all libraries are built as shared libraries by default.217 MESSAGE( STATUS "BUILD_SHARED_LIBS: " ${BUILD_SHARED_LIBS} )218 219 # the compiler used for C files220 MESSAGE( STATUS "CMAKE_C_COMPILER: " ${CMAKE_C_COMPILER} )221 222 # the compiler used for C++ files223 MESSAGE( STATUS "CMAKE_CXX_COMPILER: " ${CMAKE_CXX_COMPILER} )224 225 # if the compiler is a variant of gcc, this should be set to 1226 MESSAGE( STATUS "CMAKE_COMPILER_IS_GNUCC: " ${CMAKE_COMPILER_IS_GNUCC} )227 228 # if the compiler is a variant of g++, this should be set to 1229 MESSAGE( STATUS "CMAKE_COMPILER_IS_GNUCXX : " ${CMAKE_COMPILER_IS_GNUCXX} )230 231 # the tools for creating libraries232 MESSAGE( STATUS "CMAKE_AR: " ${CMAKE_AR} )233 MESSAGE( STATUS "CMAKE_RANLIB: " ${CMAKE_RANLIB} )234 235 MESSAGE( STATUS "=============== END TEST VARIABLES LOGGING OUTPUT ===============" )236 # ------------------------- End of Generic CMake Variable Logging ------------------237 ENDIF (XXX_FOUND) -
build/cmake/FindGDAL.cmake
r1290 r1292 1 # $Id$ 1 ############################################################################### 2 # CMake macro to find GDAL library. 2 3 # 3 # Macro to find GDAL library. 4 # On success, the macro sets the following variables: 5 # GDAL_FOUND = if the library found 6 # GDAL_LIBRARY = full path to the library 7 # GDAL_INCLUDE_DIR = where to find the library headers 4 8 # 5 # Once run this will define: 6 # GDAL_FOUND = system has GDAL lib 7 # GDAL_LIBRARY = full path to the library 8 # GDAL_INCLUDE_DIR = where to find headers 9 # On Unix, macro sets also: 10 # GDAL_VERSION_STRING = human-readable string containing version of the library 9 11 # 10 12 # Author of original: Magnus Homann (Quantum GIS) 11 # Modifi fied by libLAS team.13 # Modifications: Mateusz Loskot <mateusz@loskot.net> 12 14 # 15 ############################################################################### 16 MESSAGE(STATUS "Searching for GDAL ${GDAL_FIND_VERSION}+ library") 17 13 18 IF(WIN32) 14 19 15 IF (MINGW)20 IF(MINGW) 16 21 FIND_PATH(GDAL_INCLUDE_DIR gdal.h /usr/local/include /usr/include c:/msys/local/include) 17 22 FIND_LIBRARY(GDAL_LIBRARY NAMES gdal PATHS /usr/local/lib /usr/lib c:/msys/local/lib) 18 ENDIF (MINGW)23 ENDIF(MINGW) 19 24 20 IF (MSVC) 21 SET (GDAL_INCLUDE_DIR 22 "$ENV{LIB_DIR}/include/gdal" 23 CACHE STRING INTERNAL 24 ) 25 IF(MSVC) 26 SET(GDAL_INCLUDE_DIR "$ENV{LIB_DIR}/include/gdal" CACHE STRING INTERNAL) 25 27 FIND_LIBRARY(GDAL_LIBRARY NAMES gdal gdal_i PATHS "$ENV{LIB_DIR}/lib" /usr/lib c:/msys/local/lib) 26 28 27 IF (GDAL_LIBRARY)28 SET (GDAL_LIBRARY;odbc32;odbccp32 CACHE STRING INTERNAL)29 ENDIF (GDAL_LIBRARY)30 ENDIF (MSVC)29 IF(GDAL_LIBRARY) 30 SET(GDAL_LIBRARY;odbc32;odbccp32 CACHE STRING INTERNAL) 31 ENDIF() 32 ENDIF(MSVC) 31 33 32 ELSE (WIN32)34 ELSEIF(UNIX) 33 35 34 IF(UNIX) 36 # Try to use framework on Mac OS X 37 IF(APPLE) 38 SET(GDAL_MAC_PATH /Library/Frameworks/GDAL.framework/unix/bin) 39 ENDIF() 35 40 36 # try to use framework on mac 37 IF (APPLE) 38 SET (GDAL_MAC_PATH /Library/Frameworks/GDAL.framework/unix/bin) 39 ENDIF (APPLE) 41 # Try to use GDAL_HOME location if specified 42 IF($ENV{GDAL_HOME}) 43 SET(GDAL_CONFIG_PREFER_PATH 44 "$ENV{GDAL_HOME}/bin" CACHE STRING "Search for gdal-config program in preferred location") 45 ENDIF() 40 46 41 SET(GDAL_CONFIG_PREFER_PATH 42 "$ENV{GDAL_HOME}/bin" CACHE STRING "preferred path to GDAL (gdal-config)" 43 ) 44 SET(GDAL_CONFIG_PREFER_FWTOOLS_PATH 45 "$ENV{FWTOOLS_HOME}/bin_safe" CACHE STRING "preferred path to GDAL (gdal-config) from FWTools" 46 ) 47 # Try to use OSGeo4W installation 48 IF($ENV{OSGEO4W_HOME}) 49 SET(GDAL_CONFIG_PREFER_OSGEO4W_PATH 50 "$ENV{OSGEO4W_HOME}/bin" CACHE STRING "Search for gdal-config program provided by OSGeo4W") 51 ENDIF() 52 53 # Try to use FWTools installation 54 IF($ENV{FWTOOLS_HOME}) 55 SET(GDAL_CONFIG_PREFER_FWTOOLS_PATH 56 "$ENV{FWTOOLS_HOME}/bin_safe" CACHE STRING "Search for gdal-config program provided by FWTools") 57 ENDIF() 58 47 59 FIND_PROGRAM(GDAL_CONFIG gdal-config 48 60 ${GDAL_CONFIG_PREFER_PATH} 61 ${GDAL_CONFIG_PREFER_OSGEO4W_PATH} 49 62 ${GDAL_CONFIG_PREFER_FWTOOLS_PATH} 50 63 ${GDAL_MAC_PATH} 51 64 /usr/local/bin/ 52 /usr/bin/ 53 ) 54 #MESSAGE("DBG GDAL_CONFIG ${GDAL_CONFIG}") 65 /usr/bin/) 55 66 56 IF (GDAL_CONFIG) 67 IF(GDAL_CONFIG) 68 # Extract GDAL version 69 EXEC_PROGRAM(${GDAL_CONFIG} ARGS --version OUTPUT_VARIABLE GDAL_VERSION) 70 SET(GDAL_VERSION_STRING "${GDAL_VERSION}" CACHE STRING "Version of GDAL package found") 57 71 58 # extract gdal version59 EXEC_PROGRAM(${GDAL_CONFIG}60 ARGS --version61 OUTPUT_VARIABLE GDAL_VERSION62 )63 72 STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\1" GDAL_VERSION_MAJOR "${GDAL_VERSION}") 64 73 STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\2" GDAL_VERSION_MINOR "${GDAL_VERSION}") 65 74 66 #MESSAGE("DBG GDAL_VERSION ${GDAL_VERSION}") 67 #MESSAGE("DBG GDAL_VERSION_MAJOR ${GDAL_VERSION_MAJOR}") 68 #MESSAGE("DBG GDAL_VERSION_MINOR ${GDAL_VERSION_MINOR}") 69 70 # check for gdal version 71 # version 1.2.5 is known NOT to be supported (missing CPL_STDCALL macro) 72 # According to INSTALL, 1.4.0+ is required 73 IF (GDAL_VERSION_MAJOR LESS 1 OR GDAL_VERSION_MINOR LESS 4) 74 MESSAGE (FATAL_ERROR "GDAL version is too old (${GDAL_VERSION}). Use 1.4.0 or higher.") 75 ENDIF (GDAL_VERSION_MAJOR LESS 1 OR GDAL_VERSION_MINOR LESS 4) 75 # Check for GDAL version 76 # TODO: What version is requiredfor libLAS? --mloskot 77 IF(GDAL_VERSION_MAJOR LESS 1 OR GDAL_VERSION_MINOR LESS 6) 78 MESSAGE (FATAL_ERROR "GDAL version is too old (${GDAL_VERSION}). Use 1.6.0 or higher.") 79 ENDIF() 76 80 77 # set INCLUDE_DIR to prefix+include81 # Set INCLUDE_DIR to prefix+include 78 82 EXEC_PROGRAM(${GDAL_CONFIG} ARGS --prefix OUTPUT_VARIABLE GDAL_PREFIX) 79 83 80 #SET(GDAL_INCLUDE_DIR ${GDAL_PREFIX}/include CACHE STRING INTERNAL)81 84 FIND_PATH(GDAL_INCLUDE_DIR 82 85 gdal.h … … 84 87 ${GDAL_PREFIX}/include 85 88 /usr/local/include 86 /usr/include 87 ) 89 /usr/include) 88 90 89 # extract link dirs for rpath90 EXEC_PROGRAM(${GDAL_CONFIG} ARGS --libs OUTPUT_VARIABLE GDAL_CONFIG_LIBS )91 # Extract link dirs for rpath 92 EXEC_PROGRAM(${GDAL_CONFIG} ARGS --libs OUTPUT_VARIABLE GDAL_CONFIG_LIBS) 91 93 92 # split off the link dirs (for rpath)93 # use regular expression to match wildcard equivalent "-L*<endchar>"94 # Split off the link dirs (for rpath) 95 # Use regular expression to match wildcard equivalent "-L*<endchar>" 94 96 # with <endchar> is a space or a semicolon 95 STRING(REGEX MATCHALL "[-][L]([^ ;])+" 96 GDAL_LINK_DIRECTORIES_WITH_PREFIX 97 "${GDAL_CONFIG_LIBS}" 98 ) 99 # MESSAGE("DBG GDAL_LINK_DIRECTORIES_WITH_PREFIX=${GDAL_LINK_DIRECTORIES_WITH_PREFIX}") 97 STRING(REGEX MATCHALL "[-][L]([^ ;])+" GDAL_LINK_DIRECTORIES_WITH_PREFIX "${GDAL_CONFIG_LIBS}") 98 #MESSAGE("DBG GDAL_LINK_DIRECTORIES_WITH_PREFIX=${GDAL_LINK_DIRECTORIES_WITH_PREFIX}") 100 99 101 # remove prefix -L because we need the pure directory for LINK_DIRECTORIES 100 # Remove prefix -L because we need the pure directory for LINK_DIRECTORIES 101 IF(GDAL_LINK_DIRECTORIES_WITH_PREFIX) 102 STRING(REGEX REPLACE "[-][L]" "" GDAL_LINK_DIRECTORIES "${GDAL_LINK_DIRECTORIES_WITH_PREFIX}" ) 103 #MESSAGE("DBG GDAL_LINK_DIRECTORIES ${GDAL_LINK_DIRECTORIES}") 104 ENDIF() 102 105 103 IF (GDAL_LINK_DIRECTORIES_WITH_PREFIX) 104 STRING(REGEX REPLACE "[-][L]" "" GDAL_LINK_DIRECTORIES ${GDAL_LINK_DIRECTORIES_WITH_PREFIX} ) 105 ENDIF (GDAL_LINK_DIRECTORIES_WITH_PREFIX) 106 107 # split off the name 106 # Split off the name 108 107 # use regular expression to match wildcard equivalent "-l*<endchar>" 109 108 # with <endchar> is a space or a semicolon 110 STRING(REGEX MATCHALL "[-][l]([^ ;])+" 111 GDAL_LIB_NAME_WITH_PREFIX 112 "${GDAL_CONFIG_LIBS}" 113 ) 114 #MESSAGE("DBG GDAL_LIB_NAME_WITH_PREFIX=${GDAL_LIB_NAME_WITH_PREFIX}") 109 STRING(REGEX MATCHALL "[-][l]([^ ;])+" GDAL_LIB_NAME_WITH_PREFIX "${GDAL_CONFIG_LIBS}") 110 #MESSAGE("DBG GDAL_LIB_NAME_WITH_PREFIX ${GDAL_LIB_NAME_WITH_PREFIX}") 115 111 116 # remove prefix -l because we need the pure name 112 # Remove prefix -l because we need the pure name 113 IF(GDAL_LIB_NAME_WITH_PREFIX) 114 #STRING(REGEX REPLACE "(gdal)(.)*" "\\1" GDAL_LIB_NAME_ONLY "${GDAL_LIB_NAME_WITH_PREFIX}") 115 #MESSAGE("DBG GDAL_LIB_NAME_ONLY ${GDAL_LIB_NAME_ONLY}") 116 STRING(REGEX REPLACE "[-][l]" "" GDAL_LIB_NAME "${GDAL_LIB_NAME_ONLY}") 117 #MESSAGE("DBG GDAL_LIB_NAME ${GDAL_LIB_NAME}") 118 ENDIF() 117 119 118 IF (GDAL_LIB_NAME_WITH_PREFIX) 119 STRING(REGEX REPLACE "[-][l]" "" GDAL_LIB_NAME ${GDAL_LIB_NAME_WITH_PREFIX} ) 120 ENDIF (GDAL_LIB_NAME_WITH_PREFIX) 121 122 IF (APPLE) 120 IF(APPLE) 123 121 SET(GDAL_LIBRARY ${GDAL_LINK_DIRECTORIES}/lib${GDAL_LIB_NAME}.dylib CACHE STRING INTERNAL) 124 ELSE (APPLE)122 ELSE() 125 123 SET(GDAL_LIBRARY ${GDAL_LINK_DIRECTORIES}/lib${GDAL_LIB_NAME}.so CACHE STRING INTERNAL) 126 ENDIF (APPLE) 124 #MESSAGE("DBG GDAL_LIBRARY ${GDAL_LIBRARY}") 125 ENDIF() 127 126 128 ELSE( GDAL_CONFIG)129 MESSAGE("FindGDAL.cmake: gdal-config not found. Please set it manually .GDAL_CONFIG=${GDAL_CONFIG}")127 ELSE() 128 MESSAGE("FindGDAL.cmake: gdal-config not found. Please set it manually: GDAL_CONFIG=${GDAL_CONFIG}") 130 129 ENDIF(GDAL_CONFIG) 131 130 132 ENDIF(UNIX) 133 ENDIF(WIN32) 131 ELSE() 132 MESSAGE("FindGDAL.cmake: unrecognized or unsupported operating system (use Unix or Windows)") 133 ENDIF() 134 134 135 IF(GDAL_INCLUDE_DIR AND GDAL_LIBRARY) 136 SET(GDAL_FOUND TRUE) 137 ENDIF() 135 138 136 IF (GDAL_INCLUDE_DIR AND GDAL_LIBRARY) 137 SET(GDAL_FOUND TRUE) 138 ENDIF (GDAL_INCLUDE_DIR AND GDAL_LIBRARY) 139 140 IF (GDAL_FOUND) 141 142 IF (NOT GDAL_FIND_QUIETLY) 139 IF(GDAL_FOUND) 140 IF(NOT GDAL_FIND_QUIETLY) 143 141 MESSAGE(STATUS "Found GDAL: ${GDAL_LIBRARY}") 144 ENDIF (NOT GDAL_FIND_QUIETLY) 145 146 ELSE (GDAL_FOUND) 147 142 ENDIF() 143 ELSE() 148 144 MESSAGE(GDAL_INCLUDE_DIR=${GDAL_INCLUDE_DIR}) 149 145 MESSAGE(GDAL_LIBRARY=${GDAL_LIBRARY}) 150 146 MESSAGE(FATAL_ERROR "Could not find GDAL") 151 152 ENDIF (GDAL_FOUND) 153 147 ENDIF() -
build/cmake/FindGeoTIFF.cmake
r1290 r1292 1 # $Id$ 2 # 1 ############################################################################### 3 2 # CMake module to search for GeoTIFF library 4 3 # 5 # If it's found it sets GEOTIFF_FOUND to TRUE6 # and following variables are set:7 # GEOTIFF_INCLUDE_DIR8 # GEOTIFF_LIBRARY4 # On success, the macro sets the following variables: 5 # GEOTIFF_FOUND = if the library found 6 # GEOTIFF_LIBRARY = full path to the library 7 # GEOTIFF_INCLUDE_DIR = where to find the library headers 9 8 # 9 # On Unix, macro sets also: 10 # GEOTIFF_VERSION_STRING = human-readable string containing version of the library 10 11 # 12 # Notes: 11 13 # FIND_PATH and FIND_LIBRARY normally search standard locations 12 14 # before the specified paths. To search non-standard paths first, … … 16 18 # searching for the same item do nothing. 17 19 # 18 FIND_PATH(GEOTIFF_INCLUDE_DIR geotiff.h 19 "$ENV{LIB_DIR}/include" 20 "$ENV{LIB_DIR}/include/geotiff" 21 # MinGW 22 c:/msys/local/include 23 NO_DEFAULT_PATH 24 ) 20 # Author: Mateusz Loskot <mateusz@loskot.net> 21 # 22 ############################################################################### 23 MESSAGE(STATUS "Searching for GeoTIFF ${GeoTIFF_FIND_VERSION}+ library") 25 24 26 FIND_PATH(GEOTIFF_INCLUDE_DIR geotiff.h)25 IF(WIN32) 27 26 28 SET(GEOTIFF_NAMES ${GEOTIFF_NAMES} geotiff geotiff_i) 27 IF(MINGW) 28 FIND_PATH(GEOTIFF_INCLUDE_DIR geotiff.h /usr/local/include /usr/include c:/msys/local/include) 29 FIND_LIBRARY(GEOTIFF_LIBRARY NAMES geotiff PATHS /usr/local/lib /usr/lib c:/msys/local/lib) 30 ENDIF(MINGW) 29 31 30 FIND_LIBRARY(GEOTIFF_LIBRARY NAMES ${GEOTIFF_NAMES} PATHS 31 "$ENV{LIB_DIR}/lib"32 # MinGW33 c:/msys/local/lib34 NO_DEFAULT_PATH35 )32 IF(MSVC) 33 SET(GEOTIFF_INCLUDE_DIR "$ENV{LIB_DIR}/include" CACHE STRING INTERNAL) 34 FIND_LIBRARY(GEOTIFF_LIBRARY NAMES geotiff geotiff_i PATHS "$ENV{LIB_DIR}/lib" /usr/lib c:/msys/local/lib) 35 ENDIF(MSVC) 36 37 ELSEIF(UNIX) 36 38 37 FIND_LIBRARY(GEOTIFF_LIBRARY NAMES ${GEOTIFF_NAMES}) 39 FIND_PATH(GEOTIFF_INCLUDE_DIR 40 geotiff.h 41 "$ENV{LIB_DIR}/include" 42 "$ENV{LIB_DIR}/include/geotiff" 43 /usr/local/include 44 /usr/include) 45 46 FIND_LIBRARY(GEOTIFF_LIBRARY NAMES geotiff) 38 47 39 IF (GEOTIFF_INCLUDE_DIR AND GEOTIFF_LIBRARY) 48 ELSE() 49 MESSAGE("FindGeoTIFF.cmake: unrecognized or unsupported operating system (use Unix or Windows)") 50 ENDIF() 51 52 IF(GEOTIFF_INCLUDE_DIR AND GEOTIFF_LIBRARY) 40 53 SET(GEOTIFF_FOUND TRUE) 41 ENDIF (GEOTIFF_INCLUDE_DIR AND GEOTIFF_LIBRARY)54 ENDIF() 42 55 43 IF (GEOTIFF_FOUND) 44 45 IF (NOT GEOTIFF_FIND_QUIETLY) 56 IF(GEOTIFF_FOUND) 57 IF(NOT GEOTIFF_FIND_QUIETLY) 46 58 MESSAGE(STATUS "Found GeoTIFF: ${GEOTIFF_LIBRARY}") 47 ENDIF (NOT GEOTIFF_FIND_QUIETLY) 48 49 ELSE (GEOTIFF_FOUND) 50 59 ENDIF() 60 ELSE() 51 61 MESSAGE(STATUS "GeoTIFF library not found") 52 62 IF (GEOTIFF_FIND_REQUIRED) 53 63 MESSAGE(FATAL_ERROR "GeoTIFF library is required") 54 ENDIF (GEOTIFF_FIND_REQUIRED) 55 56 ENDIF (GEOTIFF_FOUND) 64 ENDIF() 65 ENDIF() -
src/CMakeLists.txt
r1290 r1292 1 # $Id$1 ############################################################################### 2 2 # 3 # Build the libLAS library subproject3 # src/CMakeLists.txt controls build of libLAS library 4 4 # 5 # Author: Mateusz Loskot <mateusz@loskot.net> 6 # 7 ############################################################################### 5 8 6 SET( LIBLAS_INCLUDE_DIR ../include/liblas ) 9 # Collect dependencies configuration 10 IF(GDAL_FOUND) 11 SET(LIBLAS_GDAL_CPP gt_wkt_srs.cpp gt_citation.cpp tifvsi.cpp) 12 ENDIF() 7 13 8 SET( LIBLAS_HPP 9 ../include/liblas/cstdint.hpp 10 ../include/liblas/exception.hpp 11 ../include/liblas/guid.hpp 12 ../include/liblas/iterator.hpp 13 ../include/liblas/lascolor.hpp 14 ../include/liblas/laserror.hpp 15 ../include/liblas/lasfile.hpp 16 ../include/liblas/lasheader.hpp 17 ../include/liblas/laspoint.hpp 18 ../include/liblas/lasreader.hpp 19 ../include/liblas/lasspatialreference.hpp 20 ../include/liblas/lasvariablerecord.hpp 21 ../include/liblas/laswriter.hpp 22 ../include/liblas/liblas.hpp 14 IF(SPATIALINDEX_FOUND) 15 SET(LIBLAS_INDEX_CPP 16 index/index.cpp 17 index/datastream.cpp 18 index/visitor.cpp 19 index/query.cpp 20 index/storage.cpp) 21 ENDIF() 22 23 SET(LIBLAS_INCLUDE_DIR ../include/liblas) 24 25 # 26 SET(LIBLAS_HPP 27 ${LIBLAS_INCLUDE_DIR}/cstdint.hpp 28 ${LIBLAS_INCLUDE_DIR}/exception.hpp 29 ${LIBLAS_INCLUDE_DIR}/guid.hpp 30 ${LIBLAS_INCLUDE_DIR}/iterator.hpp 31 ${LIBLAS_INCLUDE_DIR}/lascolor.hpp 32 ${LIBLAS_INCLUDE_DIR}/laserror.hpp 33 ${LIBLAS_INCLUDE_DIR}/lasfile.hpp 34 ${LIBLAS_INCLUDE_DIR}/lasheader.hpp 35 ${LIBLAS_INCLUDE_DIR}/laspoint.hpp 36 ${LIBLAS_INCLUDE_DIR}/lasreader.hpp 37 ${LIBLAS_INCLUDE_DIR}/lasspatialreference.hpp 38 ${LIBLAS_INCLUDE_DIR}/lasvariablerecord.hpp 39 ${LIBLAS_INCLUDE_DIR}/laswriter.hpp 40 ${LIBLAS_INCLUDE_DIR}/liblas.hpp) 41 42 SET( LIBLAS_DETAIL_HPP 43 ${LIBLAS_INCLUDE_DIR}/detail/endian.hpp 44 ${LIBLAS_INCLUDE_DIR}/detail/file.hpp 45 ${LIBLAS_INCLUDE_DIR}/detail/fwd.hpp 46 ${LIBLAS_INCLUDE_DIR}/detail/reader.hpp 47 ${LIBLAS_INCLUDE_DIR}/detail/reader10.hpp 48 ${LIBLAS_INCLUDE_DIR}/detail/reader11.hpp 49 ${LIBLAS_INCLUDE_DIR}/detail/reader12.hpp 50 ${LIBLAS_INCLUDE_DIR}/detail/sha1.hpp 51 ${LIBLAS_INCLUDE_DIR}/detail/sharedptr.hpp 52 ${LIBLAS_INCLUDE_DIR}/detail/timer.hpp 53 ${LIBLAS_INCLUDE_DIR}/detail/utility.hpp 54 ${LIBLAS_INCLUDE_DIR}/detail/writer.hpp 55 ${LIBLAS_INCLUDE_DIR}/detail/writer10.hpp 56 ${LIBLAS_INCLUDE_DIR}/detail/writer11.hpp 57 ${LIBLAS_INCLUDE_DIR}/detail/writer12.hpp 23 58 ) 24 59 25 SET( LIBLAS_DETAIL_HPP 26 ../include/liblas/detail/endian.hpp 27 ../include/liblas/detail/file.hpp 28 ../include/liblas/detail/fwd.hpp 29 ../include/liblas/detail/reader.hpp 30 ../include/liblas/detail/reader10.hpp 31 ../include/liblas/detail/reader11.hpp 32 ../include/liblas/detail/reader12.hpp 33 ../include/liblas/detail/sha1.hpp 34 ../include/liblas/detail/sharedptr.hpp 35 ../include/liblas/detail/timer.hpp 36 ../include/liblas/detail/utility.hpp 37 ../include/liblas/detail/writer.hpp 38 ../include/liblas/detail/writer10.hpp 39 ../include/liblas/detail/writer11.hpp 40 ../include/liblas/detail/writer12.hpp 41 ) 42 43 SET( LIBLAS_CPP 60 SET(LIBLAS_CPP 44 61 lasclassification.cpp 45 62 lascolor.cpp … … 51 68 lasspatialreference.cpp 52 69 lasvariablerecord.cpp 53 laswriter.cpp 54 ) 55 # TODO: add IF GDAL_FOUND += gt_wkt_srs.cp 70 laswriter.cpp) 56 71 57 SET( LIBLAS_DETAIL_CPP72 SET(LIBLAS_DETAIL_CPP 58 73 detail/file.cpp 59 74 detail/reader.cpp … … 64 79 detail/writer10.cpp 65 80 detail/writer11.cpp 66 detail/writer12.cpp 67 ) 81 detail/writer12.cpp) 68 82 69 SET( LIBLAS_SOURCES83 SET(LIBLAS_SOURCES 70 84 ${LIBLAS_HPP} 71 85 ${LIBLAS_DETAIL_HPP} 72 86 ${LIBLAS_CPP} 73 87 ${LIBLAS_DETAIL_CPP} 74 ) 88 ${LIBLAS_GDAL_CPP} 89 ${LIBLAS_INDEX_CPP}) 75 90 76 SET( LIBLAS_C_SOURCES 77 ../include/liblas/capi/las_config.h 78 ../include/liblas/capi/las_version.h 79 ../include/liblas/capi/liblas.h 80 las_c_api.cpp 81 ) 91 SET(LIBLAS_C_SOURCES 92 ${LIBLAS_INCLUDE_DIR}/capi/las_config.h 93 ${LIBLAS_INCLUDE_DIR}/capi/las_version.h 94 ${LIBLAS_INCLUDE_DIR}/capi/liblas.h 95 las_c_api.cpp) 82 96 83 SOURCE_GROUP( "cmake" FILES CMakeLists.txt)84 SOURCE_GROUP( "Header Files" FILES ${LIBLAS_HPP} ${LIBLAS_DETAIL_HPP})85 SOURCE_GROUP( "Source Files" FILES ${LIBLAS_CPP} ${LIBLAS_DETAIL_CPP})97 SOURCE_GROUP("CMake Files" FILES CMakeLists.txt) 98 SOURCE_GROUP("Header Files" FILES ${LIBLAS_HPP} ${LIBLAS_DETAIL_HPP}) 99 SOURCE_GROUP("Source Files" FILES ${LIBLAS_CPP} ${LIBLAS_DETAIL_CPP}) 86 100 87 101 # Diable Visual C++ language extensions when building libLAS library 88 102 IF (WIN32) 89 ADD_DEFINITIONS( /Za)90 ENDIF (WIN32)103 ADD_DEFINITIONS(/Za) 104 ENDIF() 91 105 92 106 INCLUDE_DIRECTORIES( 93 107 ../include 108 ${ZLIB_INCLUDE_DIR} 94 109 ${GDAL_INCLUDE_DIR} 95 ${GEOTIFF_INCLUDE_DIR} 96 ) 110 ${GEOTIFF_INCLUDE_DIR}) 97 111 98 112 # Static library with libLAS C++ core 99 ADD_LIBRARY( ${LIBLAS_LIB_NAME} STATIC ${LIBLAS_SOURCES})113 ADD_LIBRARY(${LIBLAS_LIB_NAME} STATIC ${LIBLAS_SOURCES}) 100 114 101 115 # Shared library with libLAS C API 102 ADD_LIBRARY( ${LIBLAS_C_LIB_NAME} SHARED ${LIBLAS_C_SOURCES} ) 103 TARGET_LINK_LIBRARIES( ${LIBLAS_C_LIB_NAME} 116 ADD_LIBRARY(${LIBLAS_C_LIB_NAME} SHARED ${LIBLAS_C_SOURCES}) 117 118 TARGET_LINK_LIBRARIES(${LIBLAS_C_LIB_NAME} 104 119 ${LIBLAS_LIB_NAME} 120 ${ZLIB_LIBRARIES} 105 121 ${GDAL_LIBRARY} 106 ${GEOTIFF_LIBRARY} 107 ) 108 122 ${GEOTIFF_LIBRARY})
Note: See TracChangeset
for help on using the changeset viewer.
