From a458342cfc457276168cb210d08c3e8b9417e6d8 Mon Sep 17 00:00:00 2001 From: Chris Pavlina Date: Sat, 12 Nov 2016 15:37:01 -0500 Subject: [PATCH] Fix KICAD_BUILD_VERSION build option --- CMakeModules/CreateGitVersionHeader.cmake | 9 +++------ CMakeModules/WriteVersionHeader.cmake | 13 ++++++++----- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/CMakeModules/CreateGitVersionHeader.cmake b/CMakeModules/CreateGitVersionHeader.cmake index 80add387f8..0dcdd1a1e9 100644 --- a/CMakeModules/CreateGitVersionHeader.cmake +++ b/CMakeModules/CreateGitVersionHeader.cmake @@ -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() diff --git a/CMakeModules/WriteVersionHeader.cmake b/CMakeModules/WriteVersionHeader.cmake index 2a09a6b32d..45f3232224 100644 --- a/CMakeModules/WriteVersionHeader.cmake +++ b/CMakeModules/WriteVersionHeader.cmake @@ -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}\"