Skip to content
Snippets Groups Projects
Commit 7a7811b6 authored by Rashad Kanavath's avatar Rashad Kanavath
Browse files

ENH: auto-detect otb version from CMakeLists.txt

parent 76446f50
No related branches found
No related tags found
No related merge requests found
......@@ -63,10 +63,6 @@ include(OTBModuleRemote)
set(main_project_name ${_OTBModuleMacros_DEFAULT_LABEL})
#Please also update PACKAGE_VERSION var in SuperBuild/CMake/External_package.cmake
#when updating values below. There is no direct way to get OTB_VERSION_STRING value
#there.. other than I use an file(READ ... REGEX) option.
#Manually updating PACKAGE_VERSION seems way better than using read file and stuff.
#-----------------------------------------------------------------------------
# OTB version number.
set(OTB_VERSION_MAJOR "5")
......
message(STATUS "Setup OTB Packaging...")
set(PACKAGE_VERSION 5.2.0)
set(PACKAGE_VERSION)
if(EXISTS "${CMAKE_SOURCE_DIR}/../CMakeLists.txt")
file(STRINGS "${CMAKE_SOURCE_DIR}/../CMakeLists.txt" _otb_version_vars REGEX "set\\\(OTB_VERSION_")
file(WRITE ${CMAKE_BINARY_DIR}/CMakeFiles/version_vars.cmake "#OTB version\n")
foreach(_otb_version_var ${_otb_version_vars})
file(APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/version_vars.cmake "${_otb_version_var}\n")
endforeach()
include(${CMAKE_BINARY_DIR}/CMakeFiles/version_vars.cmake)
if(OTB_VERSION_STRING)
set(PACKAGE_VERSION ${OTB_VERSION_STRING})
else()
message(FATAL_ERROR "Packaging: Cannot find OTB_VERSION_STRING!")
endif()
else()
message(FATAL_ERROR "Packaging: File '${CMAKE_SOURCE_DIR}/../CMakeLists.txt' does not exists")
endif()
set(PACKAGE_NAME OTB)
set(PACKAGE_LONG_NAME OrfeoToolBox)
......
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