Skip to content
Snippets Groups Projects
Commit 551c95f0 authored by Julien Malik's avatar Julien Malik
Browse files

ENH: use standard Find module for LibLAS

parent b1cf5526
No related branches found
No related tags found
No related merge requests found
# - Find LIBLAS
# Find the native LIBLAS includes and library
#
# LIBLAS_FOUND - True if LIBLAS found.
# LIBLAS_INCLUDE_DIRS - where to find tinyxml.h, etc.
# LIBLAS_LIBRARIES - List of libraries when using LIBLAS.
#
IF( LIBLAS_INCLUDE_DIR )
# Already in cache, be silent
message("silent")
SET( LIBLAS_FIND_QUIETLY TRUE )
ENDIF( LIBLAS_INCLUDE_DIR )
FIND_PATH( LIBLAS_INCLUDE_DIR liblas/capi/liblas.h )
FIND_LIBRARY( LIBLAS_LIBRARY
NAMES liblas_c liblas )
# handle the QUIETLY and REQUIRED arguments and set LIBLAS_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE( FindPackageHandleStandardArgs )
FIND_PACKAGE_HANDLE_STANDARD_ARGS( LIBLAS DEFAULT_MSG LIBLAS_INCLUDE_DIR LIBLAS_LIBRARY )
MARK_AS_ADVANCED( LIBLAS_INCLUDE_DIR LIBLAS_LIBRARY )
IF(LIBLAS_FOUND)
SET(LIBLAS_INCLUDE_DIRS ${LIBLAS_INCLUDE_DIR})
SET(LIBLAS_LIBRARIES ${LIBLAS_LIBRARY})
ELSE(LIBLAS_FOUND)
SET(LIBLAS_INCLUDE_DIRS)
SET(LIBLAS_LIBRARIES)
ENDIF(LIBLAS_FOUND)
MESSAGE(STATUS "Importing LibLAS...") MESSAGE(STATUS "Importing LibLAS...")
# Use the liblas library (do not link on solaris)
OPTION(OTB_USE_LIBLAS "Use liblas library to support Lidar data format." ON) OPTION(OTB_USE_LIBLAS "Use liblas library to support Lidar data format." ON)
MARK_AS_ADVANCED(OTB_USE_LIBLAS) MARK_AS_ADVANCED(OTB_USE_LIBLAS)
IF(OTB_USE_LIBLAS) IF(OTB_USE_LIBLAS)
FIND_PACKAGE(LibLAS)
OPTION(OTB_USE_EXTERNAL_LIBLAS "Use an outside build of LibLAS (Lidar data)." OFF)
MARK_AS_ADVANCED(OTB_USE_EXTERNAL_LIBLAS)
IF(OTB_USE_EXTERNAL_LIBLAS)
FIND_PATH(LIBLAS_INCLUDE_DIR NAMES liblas/capi/liblas.h PATHS ${OSGEO4W_INCLUDE} )
IF(LIBLAS_INCLUDE_DIR)
INCLUDE_DIRECTORIES( ${LIBLAS_INCLUDE_DIR} )
ENDIF(LIBLAS_INCLUDE_DIR)
FIND_LIBRARY(LIBLAS_LIBRARY NAMES liblas_c liblas PATHS ${OSGEO4W_LIB})
IF(LIBLAS_LIBRARY)
LINK_DIRECTORIES( ${LIBLAS_LIBRARY} )
ENDIF(LIBLAS_LIBRARY)
ENDIF(OTB_USE_EXTERNAL_LIBLAS)
IF(OTB_USE_EXTERNAL_LIBLAS)
MESSAGE(STATUS " Using LibLAS external version")
MESSAGE(STATUS " LibLAS includes : ${LIBLAS_INCLUDE_DIR}")
MESSAGE(STATUS " LibLAS library : ${LIBLAS_LIBRARY}")
ELSE(OTB_USE_EXTERNAL_LIBLAS)
MESSAGE(STATUS " Using LibLAS internal version")
ENDIF(OTB_USE_EXTERNAL_LIBLAS)
ADD_DEFINITIONS(-DLAS_DISABLE_DLL) # Initialize option with what's found on the system
IF(LIBLAS_FOUND)
OPTION(OTB_USE_EXTERNAL_LIBLAS "Use external LIBLAS library." ON)
ELSE(LIBLAS_FOUND)
OPTION(OTB_USE_EXTERNAL_LIBLAS "Use external LIBLAS library." OFF)
ENDIF(LIBLAS_FOUND)
MARK_AS_ADVANCED(OTB_USE_EXTERNAL_LIBLAS)
IF(OTB_USE_EXTERNAL_LIBLAS)
IF(LIBLAS_FOUND)
MESSAGE(STATUS "Using LibLAS external version")
ELSE(LIBLAS_FOUND)
# Generate an error if no external liblas is available
MESSAGE(FATAL_ERROR "LibLAS required but not found. "
"Either turn OTB_USE_EXTERNAL_LIBLAS to OFF to use the internal version, "
"or OTB_USE_LIBLAS to OFF to disable LAS support")
ENDIF(LIBLAS_FOUND)
ELSE(OTB_USE_EXTERNAL_LIBLAS)
MESSAGE(STATUS "Using LibLAS internal version")
SET(LIBLAS_LIBRARIES otbliblas)
ADD_DEFINITIONS(-DLAS_DISABLE_DLL)
ENDIF(OTB_USE_EXTERNAL_LIBLAS)
ENDIF(OTB_USE_LIBLAS)
ELSE(OTB_USE_LIBLAS)
MESSAGE(STATUS " Disabling LibLAS support")
ENDIF(OTB_USE_LIBLAS)
\ No newline at end of file
...@@ -39,15 +39,7 @@ ADD_LIBRARY(OTBIO ${OTBIO_SRCS}) ...@@ -39,15 +39,7 @@ ADD_LIBRARY(OTBIO ${OTBIO_SRCS})
# LINK_INTERFACE_LIBRARIES "" # LINK_INTERFACE_LIBRARIES ""
# ) # )
TARGET_LINK_LIBRARIES (OTBIO ${TIFF_LIBRARY} ${GEOTIFF_LIBRARY} ${GDAL_LIBRARY} ${OGR_LIBRARY} ${JPEG_LIBRARY} ${OPENTHREADS_LIBRARY} OTBCommon OTBBasicFilters OTBCurlAdapters) TARGET_LINK_LIBRARIES (OTBIO ${TIFF_LIBRARY} ${GEOTIFF_LIBRARY} ${GDAL_LIBRARY} ${OGR_LIBRARY} ${JPEG_LIBRARY} ${OPENTHREADS_LIBRARY} OTBCommon OTBBasicFilters OTBCurlAdapters)
TARGET_LINK_LIBRARIES (OTBIO ITKIO ITKCommon ${LIBKML_LIBRARIES} ${TINYXML_LIBRARIES}) TARGET_LINK_LIBRARIES (OTBIO ITKIO ITKCommon ${LIBKML_LIBRARIES} ${TINYXML_LIBRARIES} ${LIBLAS_LIBRARIES})
IF (OTB_USE_LIBLAS)
IF(OTB_USE_EXTERNAL_LIBLAS)
TARGET_LINK_LIBRARIES(OTBIO ${LIBLAS_LIBRARY})
ELSE(OTB_USE_EXTERNAL_LIBLAS)
TARGET_LINK_LIBRARIES(OTBIO otbliblas)
ENDIF(OTB_USE_EXTERNAL_LIBLAS)
ENDIF(OTB_USE_LIBLAS)
IF( OTB_USE_JPEG2000 ) IF( OTB_USE_JPEG2000 )
TARGET_LINK_LIBRARIES (OTBIO otbopenjpeg) TARGET_LINK_LIBRARIES (OTBIO otbopenjpeg)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment