Fix KICAD_BUILD_VERSION build option

This commit is contained in:
Chris Pavlina 2016-11-12 15:37:01 -05:00
parent 318429590e
commit 7e3c0258aa
2 changed files with 11 additions and 11 deletions

View File

@ -26,7 +26,7 @@ macro( create_git_version_header _git_src_path )
# If an error occurs using the git commands to determine the repo
# version, set the build version string to "no-git" and the default
# branch name to unknown
set( KICAD_BUILD_VERSION "no-git" )
set( KICAD_GIT_BUILD_VERSION "no-git" )
set( KICAD_BRANCH_NAME "undefined" )
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 )
string( REGEX REPLACE "^([0-9]+)\\-([0-9]+)\\-([0-9]+)" "\\1-\\2-\\3"
_kicad_git_date ${Kicad_REPO_LAST_CHANGED_DATE} )
set( KICAD_BUILD_VERSION "(${_kicad_git_date} ${Kicad_REPO_REVISION})" )
if( NOT "${KICAD_REPO_NAME}" STREQUAL "unknown" )
set( KICAD_BRANCH_NAME ${_git_BRANCH} )
endif()
set( KICAD_GIT_BUILD_VERSION "(${_kicad_git_date} ${Kicad_REPO_REVISION})" )
set( KICAD_BRANCH_NAME ${_git_BRANCH} )
endif()
set( KICAD_BUILD_VERSION ${KICAD_BUILD_VERSION} )
endmacro()

View File

@ -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." )
include( ${CMAKE_MODULE_PATH}/CreateGitVersionHeader.cmake )
create_git_version_header( ${SRC_PATH} )
set( _wvh_version_str ${KICAD_BUILD_VERSION} )
endif()
# 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
# name.
if( KICAD_BRANCH_NAME )
set( KICAD_FULL_VERSION "${_wvh_version_str}-${KICAD_BRANCH_NAME}" )
if( KICAD_BUILD_VERSION )
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()
set( KICAD_FULL_VERSION "${_wvh_version_str}" )
set( KICAD_BUILD_VERSION "unknown" )
set( KICAD_FULL_VERSION "unknown" )
endif()
set( _wvh_new_version_text
@ -57,7 +60,7 @@ set( _wvh_new_version_text
#ifndef __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_FULL_VERSION \"${KICAD_FULL_VERSION}\"