Commit 690ac02c authored by Guillaume Pasero's avatar Guillaume Pasero

SuperBuild: detection of OTB version

parent 1aaf500d
......@@ -212,7 +212,7 @@ ExternalProject_Add(${proj}
# detect OTB version number
if (SUPERBUILD_OTB_VERSION)
set(_SB_${proj}_DIR ${SB_INSTALL_PREFIX}/lib/cmake/OTB-${SUPERBUILD_OTB_VERSION})
set(_SB_${proj}_DIR ${SB_INSTALL_PREFIX}/lib/cmake/OTB-${SUPERBUILD_OTB_VERSION_MAJOR}.${SUPERBUILD_OTB_VERSION_MINOR})
else()
set(_SB_${proj}_DIR ${SB_INSTALL_PREFIX})
endif()
......
......@@ -37,8 +37,12 @@ if(EXISTS "${CMAKE_SOURCE_DIR}/../CMakeLists.txt")
if(NOT "${_CONTENT_CMAKELIST}" STREQUAL "")
set(SUPERBUILD_IN_OTB_TREE ON)
# parse the version number
# TODO
set(SUPERBUILD_OTB_VERSION "5.3.0")
file(STRINGS "${CMAKE_SOURCE_DIR}/../CMakeLists.txt" _FULL_CONTENT_CMAKELIST)
string(REGEX REPLACE ".*set\\(OTB_VERSION_MAJOR \"([0-9]+)\"\\).*" "\\1" SUPERBUILD_OTB_VERSION_MAJOR "${_FULL_CONTENT_CMAKELIST}")
string(REGEX REPLACE ".*set\\(OTB_VERSION_MINOR \"([0-9]+)\"\\).*" "\\1" SUPERBUILD_OTB_VERSION_MINOR "${_FULL_CONTENT_CMAKELIST}")
string(REGEX REPLACE ".*set\\(OTB_VERSION_PATCH \"([0-9]+)\"\\).*" "\\1" SUPERBUILD_OTB_VERSION_PATCH "${_FULL_CONTENT_CMAKELIST}")
set(SUPERBUILD_OTB_VERSION "${SUPERBUILD_OTB_VERSION_MAJOR}.${SUPERBUILD_OTB_VERSION_MINOR}.${SUPERBUILD_OTB_VERSION_PATCH}")
message(STATUS "Found OTB version : ${SUPERBUILD_OTB_VERSION}")
endif()
endif()
message(STATUS "Check if superbuild is in OTB tree : ${SUPERBUILD_IN_OTB_TREE}")
......
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