Newer
Older
# This is the root OTB CMakeLists file.
# $Id$
#
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
Emmanuel Christophe
committed
IF(COMMAND CMAKE_POLICY)
Emmanuel Christophe
committed
ENDIF(COMMAND CMAKE_POLICY)
Emmanuel Christophe
committed
# Path to additional CMake modules
SET(CMAKE_MODULE_PATH
${CMAKE_SOURCE_DIR}/CMake
${CMAKE_MODULE_PATH})
INCLUDE_REGULAR_EXPRESSION("^(otb|itk|vtk|vnl|vcl|vxl|f2c|netlib|ce|itpack|DICOM|meta|png|dbh|tif|jpeg|zlib).*$")
SOURCE_GROUP("XML Files" REGULAR_EXPRESSION "[.]xml$")
# On Visual Studio 8 MS deprecated C. This removes all 1.276E1265 security
# warnings
IF(WIN32)
IF(NOT BORLAND)
IF(NOT CYGWIN)
IF(NOT MINGW)
IF(NOT ITK_ENABLE_VISUAL_STUDIO_DEPRECATED_C_WARNINGS)
ADD_DEFINITIONS(
-D_CRT_FAR_MAPPINGS_NO_DEPRECATE
-D_CRT_IS_WCTYPE_NO_DEPRECATE
-D_CRT_MANAGED_FP_NO_DEPRECATE
-D_CRT_NONSTDC_NO_DEPRECATE
-D_CRT_SECURE_NO_DEPRECATE
-D_CRT_SECURE_NO_DEPRECATE_GLOBALS
-D_CRT_SETERRORMODE_BEEP_SLEEP_NO_DEPRECATE
-D_CRT_TIME_FUNCTIONS_NO_DEPRECATE
-D_CRT_VCCLRIT_NO_DEPRECATE
-D_SCL_SECURE_NO_DEPRECATE
)
ENDIF(NOT ITK_ENABLE_VISUAL_STUDIO_DEPRECATED_C_WARNINGS)
ENDIF(NOT MINGW)
ENDIF(NOT CYGWIN)
ENDIF(NOT BORLAND)
ENDIF(WIN32)
# __CYGWIN__ must be define for ossim (ex: ossimCommon.h, isnan definition, .. )
#IF(CYGWIN)
# ADD_DEFINITIONS(-D__CYGWIN__)
#ENDIF(CYGWIN)
# If CMake is the version we're expecting, don't show the
OTB Bot
committed
# CMAKE_BACKWARDS_COMPATIBILITY option. If the version is higher than the
# minimal version required, then show the backward compatibility option.
IF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" MATCHES "^2\\.4$")
MARK_AS_ADVANCED(FORCE CMAKE_BACKWARDS_COMPATIBILITY)
OTB Bot
committed
ELSE("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" MATCHES "^2\\.4$")
MARK_AS_ADVANCED(CLEAR CMAKE_BACKWARDS_COMPATIBILITY)
OTB Bot
committed
ENDIF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" MATCHES "^2\\.4$")
#-----------------------------------------------------------------------------
# OTB option to access large file (> 4Go).
ADD_DEFINITIONS(
-D_LARGEFILE_SOURCE
-D_LARGEFILE64_SOURCE
-D_LARGE_FILES
#-----------------------------------------------------------------------------
# OTB version number. An even minor number corresponds to releases.
SET(OTB_VERSION_MAJOR "3")
SET(OTB_VERSION_MINOR "0")
# Version string should not include patch level. The major.minor is
# enough to distinguish available features of the toolkit.
SET(OTB_VERSION_STRING "${OTB_VERSION_MAJOR}.${OTB_VERSION_MINOR}.${OTB_VERSION_PATCH}")
Thomas Feuvrier
committed
# => Comment for OTB 3.0.0
OPTION(BUILD_TESTING "Build testing." OFF)

Julien Michel
committed
#-----------------------------------------------------------------------------
# OTB build configuration options.
IF(WIN32)
# do not build shared lib under windows
SET(BUILD_SHARED_LIBS OFF)
MESSAGE("Disabling build shared lib option on windows like OS.")
ELSE(WIN32)
OPTION(BUILD_SHARED_LIBS "Build OTB with shared libraries." ON)
ENDIF(WIN32)
SET(OTB_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS})
Thomas Feuvrier
committed
IF(NOT OTB_NO_LIBRARY_VERSION)
# This setting of SOVERSION assumes that any API change
# will increment either the minor or major version number of OTB.
SET(OTB_LIBRARY_PROPERTIES
Thomas Feuvrier
committed
VERSION "${OTB_VERSION_MAJOR}.${OTB_VERSION_MINOR}.${OTB_VERSION_PATCH}"
SOVERSION "${OTB_VERSION_MAJOR}.${OTB_VERSION_MINOR}"
)
ENDIF(NOT OTB_NO_LIBRARY_VERSION)
SET(OTB_BUILD_PEDANTIC OFF CACHE BOOL
"Choose compilation in pedantic or relaxed mode")
Thomas Feuvrier
committed
IF(WIN32)
IF (MSVC)
IF(OTB_BUILD_PEDANTIC)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
IF (MSVC80)
ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS)
ADD_DEFINITIONS(-D_CRT_NONSTDC_NO_WARNING)
ENDIF(MSVC80)
ENDIF(MSVC)
ELSE(WIN32)
IF(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
IF(OTB_BUILD_PEDANTIC)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic")
ENDIF(OTB_BUILD_PEDANTIC)
ENDIF(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
ENDIF(WIN32)
#-----------------------------------------------------------------------------
# Case for release 2.2.1
# Use the openjpeg library.
OPTION(OTB_USE_JPEG2000 "Use to support jpeg2000 image file format." ON)
#-----------------------------------------------------------------------------
Emmanuel Christophe
committed
# Use the liblas library (do not link on solaris)
OPTION(OTB_USE_LIBLAS "Use liblas library to support Lidar data format." ON)
MARK_AS_ADVANCED(OTB_USE_LIBLAS)
Thomas Feuvrier
committed
# FIND EXTERNAL LIBRAIRIES USE
#-------------------------------
# EXPAT Library
#-------------------------------
FIND_PACKAGE(EXPAT)
IF(EXPAT_FOUND)
OPTION(OTB_USE_EXTERNAL_EXPAT "Use an outside build of EXPAT." ON)
ELSE(EXPAT_FOUND)
OPTION(OTB_USE_EXTERNAL_EXPAT "Use an outside build of EXPAT." OFF)
ENDIF(EXPAT_FOUND)
Thomas Feuvrier
committed
MARK_AS_ADVANCED(OTB_USE_EXTERNAL_EXPAT)

Julien Michel
committed
Thomas Feuvrier
committed
IF(OTB_USE_EXTERNAL_EXPAT)
FIND_PACKAGE(EXPAT)
IF(EXPAT_FOUND)
# Control expat compatibility
INCLUDE_DIRECTORIES(BEFORE ${EXPAT_INCLUDE_DIR})
LINK_DIRECTORIES( ${EXPAT_LIBRARY} )
Thomas Feuvrier
committed
ELSE(EXPAT_FOUND)
MESSAGE(FATAL_ERROR
"Cannot build OTB project without lib EXPAT. Please set EXPAT_DIR or set OTB_USE_EXTERNAL_EXPAT OFF to use INTERNAL EXPAT set on OTB/Utilities repository.")
ENDIF(EXPAT_FOUND)
ELSE(OTB_USE_EXTERNAL_EXPAT)
ADD_DEFINITIONS(-DOTB_USE_INTERNAL_EXPAT)
INCLUDE_DIRECTORIES(BEFORE "${OTB_SOURCE_DIR}/Utilities/otbexpat")
INCLUDE_DIRECTORIES(BEFORE "${OTB_BINARY_DIR}/Utilities/otbexpat")
IF(NOT BUILD_SHARED_LIBS)
ADD_DEFINITIONS(-DXML_STATIC)
ENDIF(NOT BUILD_SHARED_LIBS)
Thomas Feuvrier
committed
ENDIF(OTB_USE_EXTERNAL_EXPAT)
Thomas Feuvrier
committed
#-------------------------------
# ITK Library
#-------------------------------
OPTION(OTB_USE_EXTERNAL_ITK "Use an outside build of ITK." OFF)
IF(OTB_USE_EXTERNAL_ITK)
FIND_PACKAGE(ITK)
IF(ITK_FOUND)
# Builf ITK_INCLUDE_DIRS list wihout expat path
SET(new_list "")
FOREACH(files_h ${ITK_INCLUDE_DIRS})
IF(NOT "${files_h}" MATCHES "expat")
SET(new_list "${new_list};${files_h}")
ENDIF(NOT "${files_h}" MATCHES "expat")
ENDFOREACH(files_h ${ITK_INCLUDE_DIRS})
SET(ITK_INCLUDE_DIRS "${new_list}")
Thomas Feuvrier
committed
INCLUDE(${ITK_USE_FILE})
ELSE(ITK_FOUND)
MESSAGE(FATAL_ERROR
"Cannot build OTB project without ITK. Please set ITK_DIR or set OTB_USE_EXTERNAL_ITK OFF to use INTERNAL ITK set on OTB/Utilities repository.")
ENDIF(ITK_FOUND)
ELSE(OTB_USE_EXTERNAL_ITK)
# Required to have proper itk headers at first run
SET(ITK_SOURCE_DIR ${OTB_SOURCE_DIR}/Utilities/ITK)
SET(ITK_BINARY_DIR ${OTB_BINARY_DIR}/Utilities/ITK)
ENDIF(OTB_USE_EXTERNAL_ITK)
# JPEG2000 specification control
IF( OTB_USE_JPEG2000 )
Loading
Loading full blame...