Commit 5999005e authored by Manuel Grizonnet's avatar Manuel Grizonnet

BUG: fix several problems in detection of GDAL version

- Move declaration of GDAL_CONFIG_CHECKING in otb-module-init.cmake to ensure gdal configuration in all cases (if statement)
- OTBCommon module needs to depend on OTBGDAL as GDAL module has to set OTB_USE_GDAL_20 before configuring otbConfigure.h
- Set mode to STATUS for GDAL version >= to 2.0

All these issues were found compiling gdal trunk (2.1.0dev) with clang 3.5.
parent f132a18a
......@@ -4,6 +4,8 @@ otb_module(OTBCommon
DEPENDS
OTBBoost
OTBITK
#Add dependency to OTBGDAL as GDAL module need to set OTB_USE_GDAL_20 before configuring otbConfigure.h
OTBGDAL
TEST_DEPENDS
OTBImageBase
......
......@@ -3,7 +3,4 @@ project(OTBGDAL)
set(OTBGDAL_SYSTEM_INCLUDE_DIRS ${GDAL_INCLUDE_DIRS})
set(OTBGDAL_LIBRARIES "${GDAL_LIBRARIES}")
set(GDAL_CONFIG_CHECKING ON CACHE BOOL "Tests to check gdal config." FORCE)
mark_as_advanced(GDAL_CONFIG_CHECKING)
otb_module_impl()
......@@ -8,6 +8,10 @@ if(NOT GDAL_FOUND)
message(FATAL_ERROR "Cannot find GDAL. Set GDAL_INCLUDE_DIR and GDAL_LIBRARY")
endif()
#Allow to deactivate GDAL checking (done by default)
set(GDAL_CONFIG_CHECKING ON CACHE BOOL "Tests to check gdal config." FORCE)
mark_as_advanced(GDAL_CONFIG_CHECKING)
if(GDAL_CONFIG_CHECKING)
set(MIN_MAJOR_VERSION 1)
set(MIN_MINOR_VERSION 10)
......@@ -89,7 +93,7 @@ if(GDAL_CONFIG_CHECKING)
file(READ "${TEMP}/gdalVersion.txt" DETECTED_VERSION)
string(SUBSTRING ${DETECTED_VERSION} 0 2 VER2)
if(${VER2} EQUAL "2.")
message("-- Gdal >= 2.0.0 detected")
message(STATUS "Gdal >= 2.0.0 detected")
set(OTB_USE_GDAL_20 true CACHE INTERNAL "True if GDAL >= 2.0.0 has been detected" FORCE )
else(${VER2} EQUAL "2.")
set(OTB_USE_GDAL_20 false CACHE INTERNAL "True if GDAL >= 2.0.0 has been detected" FORCE )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment