Commit 35e0ea68 authored by Guillaume Pasero's avatar Guillaume Pasero

BUG: fix Ossim version checking for 1.8.20-3

parent f5f5e499
......@@ -14,6 +14,7 @@ endif()
find_path( OSSIM_INCLUDE_DIR
NAMES ossim/init/ossimInit.h )
# Version checking
if(EXISTS "${OSSIM_INCLUDE_DIR}/ossim/ossimVersion.h")
file(READ "${OSSIM_INCLUDE_DIR}/ossim/ossimVersion.h" _ossim_version_h_CONTENTS)
string(REGEX REPLACE ".*# *define OSSIM_VERSION *\"([0-9.]+)\".*" "\\1" OSSIM_VERSION "${_ossim_version_h_CONTENTS}")
......@@ -22,33 +23,27 @@ if(EXISTS "${OSSIM_INCLUDE_DIR}/ossim/ossimVersion.h")
string(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\3" OSSIM_PATCH_VERSION_NUMBER "${OSSIM_VERSION}")
math(EXPR OSSIM_VERSION_NUMBER
"((${OSSIM_MAJOR_VERSION_NUMBER})*100+${OSSIM_MINOR_VERSION_NUMBER})*100+${OSSIM_PATCH_VERSION_NUMBER}")
else()
if(NOT Ossim_FIND_QUIETLY)
message(WARNING "ossimVersion.h not found !")
endif()
endif()
# Parse a certain header to check if SVN revision is 23537
if(EXISTS "${OSSIM_INCLUDE_DIR}/ossim/imaging/ossimImageRenderer.h")
file(STRINGS "${OSSIM_INCLUDE_DIR}/ossim/imaging/ossimImageRenderer.h" _ossim_image_renderer_h_CONTENTS REGEX "^// \\$Id: ossimImageRenderer\\.h [0-9.]+ ")
string(REGEX REPLACE ".*ossimImageRenderer\\.h ([0-9.]+) .*" "\\1" _ossim_svn_revision_hint "${_ossim_image_renderer_h_CONTENTS}")
if("${_ossim_svn_revision_hint}" LESS "23537")
if("${OSSIM_VERSION}" VERSION_LESS "1.8.20")
message(WARNING "The OSSIM include directory detected by OTB is: '${OSSIM_INCLUDE_DIR}'."
"This version does not have support for SENTINEL-1 products."
"Opening an image will result in immediate crash!. "
"Please consider updating your ossim to latest stable release.(1.8.20-3)")
"This version (${OSSIM_VERSION}) is not fully compatible with OTB."
"Please consider updating your Ossim to version 1.8.20-3 or above")
else()
if("${_ossim_svn_revision_hint}" LESS "23664")
message(WARNING "The OSSIM include directory detected by OTB is '${OSSIM_INCLUDE_DIR}'."
"This version has a critical bug inside ossimRpcModel."
"When an input point outside image extent is given the model returns 'NaN'."
"Please consider updating your ossim to latest stable release.(1.8.20-3)")
if("${OSSIM_VERSION}" VERSION_EQUAL "1.8.20")
# special case to detect versions 1.8.20-1 and 1.8.20-2
if(EXISTS "${OSSIM_INCLUDE_DIR}/ossim/projection/ossimRpcProjection.h")
file(STRINGS "${OSSIM_INCLUDE_DIR}/ossim/projection/ossimRpcProjection.h" _ossim_rpc_proj_h_CONTENTS REGEX "^// \\$Id: ossimRpcProjection\\.h [0-9.]+ ")
string(REGEX REPLACE ".*ossimRpcProjection\\.h ([0-9.]+) .*" "\\1" _ossim_svn_revision_hint "${_ossim_rpc_proj_h_CONTENTS}")
if("${_ossim_svn_revision_hint}" LESS "23666")
message(WARNING "The OSSIM include directory detected by OTB is: '${OSSIM_INCLUDE_DIR}'."
"This version (${OSSIM_VERSION}, rev < r23666) is not fully compatible with OTB."
"Please consider updating your Ossim to version 1.8.20-3 or above")
endif()
endif()
endif()
endif()
else()
if(NOT Ossim_FIND_QUIETLY)
message(WARNING "ossimImageRenderer.h not found !")
message(WARNING "ossimVersion.h not found !")
endif()
endif()
......
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