Fix KICAD_BUILD_VERSION build option
This commit is contained in:
parent
318429590e
commit
7e3c0258aa
|
@ -26,7 +26,7 @@ macro( create_git_version_header _git_src_path )
|
||||||
# If an error occurs using the git commands to determine the repo
|
# If an error occurs using the git commands to determine the repo
|
||||||
# version, set the build version string to "no-git" and the default
|
# version, set the build version string to "no-git" and the default
|
||||||
# branch name to unknown
|
# branch name to unknown
|
||||||
set( KICAD_BUILD_VERSION "no-git" )
|
set( KICAD_GIT_BUILD_VERSION "no-git" )
|
||||||
set( KICAD_BRANCH_NAME "undefined" )
|
set( KICAD_BRANCH_NAME "undefined" )
|
||||||
set( KICAD_FULL_VERSION "${KICAD_BUILD_VERSION}-${KICAD_BRANCH_NAME}")
|
set( KICAD_FULL_VERSION "${KICAD_BUILD_VERSION}-${KICAD_BRANCH_NAME}")
|
||||||
|
|
||||||
|
@ -101,11 +101,8 @@ macro( create_git_version_header _git_src_path )
|
||||||
if( Kicad_REPO_LAST_CHANGED_DATE )
|
if( Kicad_REPO_LAST_CHANGED_DATE )
|
||||||
string( REGEX REPLACE "^([0-9]+)\\-([0-9]+)\\-([0-9]+)" "\\1-\\2-\\3"
|
string( REGEX REPLACE "^([0-9]+)\\-([0-9]+)\\-([0-9]+)" "\\1-\\2-\\3"
|
||||||
_kicad_git_date ${Kicad_REPO_LAST_CHANGED_DATE} )
|
_kicad_git_date ${Kicad_REPO_LAST_CHANGED_DATE} )
|
||||||
set( KICAD_BUILD_VERSION "(${_kicad_git_date} ${Kicad_REPO_REVISION})" )
|
set( KICAD_GIT_BUILD_VERSION "(${_kicad_git_date} ${Kicad_REPO_REVISION})" )
|
||||||
if( NOT "${KICAD_REPO_NAME}" STREQUAL "unknown" )
|
|
||||||
set( KICAD_BRANCH_NAME ${_git_BRANCH} )
|
set( KICAD_BRANCH_NAME ${_git_BRANCH} )
|
||||||
endif()
|
endif()
|
||||||
endif()
|
|
||||||
|
|
||||||
set( KICAD_BUILD_VERSION ${KICAD_BUILD_VERSION} )
|
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
|
@ -36,16 +36,19 @@ if( _wvh_version_str STREQUAL "no-vcs-found" AND EXISTS "${SRC_PATH}/.git" )
|
||||||
message( STATUS "Using Git to determine build version string." )
|
message( STATUS "Using Git to determine build version string." )
|
||||||
include( ${CMAKE_MODULE_PATH}/CreateGitVersionHeader.cmake )
|
include( ${CMAKE_MODULE_PATH}/CreateGitVersionHeader.cmake )
|
||||||
create_git_version_header( ${SRC_PATH} )
|
create_git_version_header( ${SRC_PATH} )
|
||||||
set( _wvh_version_str ${KICAD_BUILD_VERSION} )
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# If KICAD_BRANCH_NAME is empty, set KICAD_FULL_VERSION to just the build
|
# If KICAD_BRANCH_NAME is empty, set KICAD_FULL_VERSION to just the build
|
||||||
# version rather than the concatenation of the build version and the branch
|
# version rather than the concatenation of the build version and the branch
|
||||||
# name.
|
# name.
|
||||||
if( KICAD_BRANCH_NAME )
|
if( KICAD_BUILD_VERSION )
|
||||||
set( KICAD_FULL_VERSION "${_wvh_version_str}-${KICAD_BRANCH_NAME}" )
|
set( KICAD_FULL_VERSION "${KICAD_BUILD_VERSION}" )
|
||||||
|
elseif( KICAD_BRANCH_NAME AND KICAD_GIT_BUILD_VERSION )
|
||||||
|
set( KICAD_BUILD_VERSION "${KICAD_GIT_BUILD_VERSION}" )
|
||||||
|
set( KICAD_FULL_VERSION "${KICAD_GIT_BUILD_VERSION}-${KICAD_BRANCH_NAME}" )
|
||||||
else()
|
else()
|
||||||
set( KICAD_FULL_VERSION "${_wvh_version_str}" )
|
set( KICAD_BUILD_VERSION "unknown" )
|
||||||
|
set( KICAD_FULL_VERSION "unknown" )
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set( _wvh_new_version_text
|
set( _wvh_new_version_text
|
||||||
|
@ -57,7 +60,7 @@ set( _wvh_new_version_text
|
||||||
#ifndef __KICAD_VERSION_H__
|
#ifndef __KICAD_VERSION_H__
|
||||||
#define __KICAD_VERSION_H__
|
#define __KICAD_VERSION_H__
|
||||||
|
|
||||||
#define KICAD_BUILD_VERSION \"${_wvh_version_str}\"
|
#define KICAD_BUILD_VERSION \"${KICAD_BUILD_VERSION}\"
|
||||||
#define KICAD_BRANCH_NAME \"${KICAD_BRANCH_NAME}\"
|
#define KICAD_BRANCH_NAME \"${KICAD_BRANCH_NAME}\"
|
||||||
#define KICAD_FULL_VERSION \"${KICAD_FULL_VERSION}\"
|
#define KICAD_FULL_VERSION \"${KICAD_FULL_VERSION}\"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue