Commit a307c236 authored by Cédric Traizet's avatar Cédric Traizet

BUG: fix get_package_name for the release branch

parent aa45f3b0
Pipeline #5612 failed with stages
in 152 minutes and 1 second
......@@ -55,7 +55,7 @@
# Author: Nuno Fachada
function(get_package_name root_repo_dir project_version_string)
function(get_package_name root_repo_dir project project_version_string)
if(EXISTS "${root_repo_dir}/.git")
find_package(Git)
......@@ -63,12 +63,6 @@ function(get_package_name root_repo_dir project_version_string)
message(ERROR "git not found. Make sure git can be found in your PATH")
return()
endif()
message(STATUS "PROJECT_NAME: ${PROJECT_NAME}")
message(STATUS "VERSION MINOR: ${${PROJECT_NAME}_VERSION_MAJOR}")
message(STATUS "VERSION MAJOR: ${${PROJECT_NAME}_VERSION_MINOR}")
message(STATUS "VERSION PATCH: ${${PROJECT_NAME}_VERSION_PATCH}")
if(DEFINED ENV{CI_COMMIT_REF_NAME})
set(branch_name "$ENV{CI_COMMIT_REF_NAME}")
......@@ -88,7 +82,7 @@ function(get_package_name root_repo_dir project_version_string)
if("${branch_name}" MATCHES "^release-[0-9]+\\.[0-9]+\$")
set(${project_version_string} "${${PROJECT_NAME}_VERSION_MAJOR}.${${PROJECT_NAME}_VERSION_MINOR}.${${PROJECT_NAME}_VERSION_PATCH}" PARENT_SCOPE)
set(${project_version_string} "${${project}_VERSION_MAJOR}.${${project}_VERSION_MINOR}.${${project}_VERSION_PATCH}" PARENT_SCOPE)
else()
if(DEFINED ENV{CI_COMMIT_SHORT_SHA})
......@@ -96,9 +90,9 @@ function(get_package_name root_repo_dir project_version_string)
else()
execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE ${PROJECT_NAME}_COMMIT_SHA_STRING
OUTPUT_VARIABLE ${project}_COMMIT_SHA_STRING
OUTPUT_STRIP_TRAILING_WHITESPACE)
set(${project_version_string} "${branch_name}-${${PROJECT_NAME}_COMMIT_SHA_STRING}" PARENT_SCOPE)
set(${project_version_string} "${branch_name}-${${project}_COMMIT_SHA_STRING}" PARENT_SCOPE)
endif()
endif()
......
......@@ -137,10 +137,7 @@ set(OTB_VERSION_MINOR "2")
set(OTB_VERSION_PATCH "0")
set(OTB_VERSION_STRING "${OTB_VERSION_MAJOR}.${OTB_VERSION_MINOR}.${OTB_VERSION_PATCH}")
get_package_name(${OTB_SOURCE_DIR} OTB_VERSION_STRING2)
message(STATUS "## ${OTB_VERSION_STRING2} ##")
get_package_name(${OTB_SOURCE_DIR} ${PROJECT_NAME} OTB_VERSION_STRING2)
# Monteverdi version number (follows OTB)
set( Monteverdi_VERSION_MAJOR ${OTB_VERSION_MAJOR} )
......
......@@ -106,11 +106,8 @@ if(OTB_TARGET_SYSTEM_ARCH_IS_X64)
set(PACKAGE_ARCH "64")
endif()
include(${PACKAGE_OTB_SRC_DIR}/CMake/GetVersionFromGitTag.cmake)
get_package_name(${PACKAGE_OTB_SRC_DIR} OTB_VERSION_STRING2)
message(STATUS "OTB_VERSION_STRING2 : ${OTB_VERSION_STRING2}")
get_package_name(${PACKAGE_OTB_SRC_DIR} PKG_OTB OTB_VERSION_STRING2)
# This directory is important.
# We stage/keep files that goes into final package in this directory
......
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