Add a way to add a "revision" for use in windows manifests

This commit is contained in:
Marek Roszko 2022-01-15 15:20:27 -05:00
parent b605d6d9ae
commit d4ee74a832
2 changed files with 13 additions and 3 deletions

View File

@ -38,10 +38,10 @@ if( CMAKE_MATCH_COUNT EQUAL 2 )
set( KICAD_MAJOR_MINOR_VERSION "${CMAKE_MATCH_1}.${CMAKE_MATCH_2}" )
set( KICAD_MAJOR_MINOR_VERSION_TUPLE "{ ${CMAKE_MATCH_1}, ${CMAKE_MATCH_2} }" )
set( KICAD_MAJOR_VERSION "${CMAKE_MATCH_1}" )
set( KICAD_WIN32_RC_FILEVER_STR "${CMAKE_MATCH_1}.${CMAKE_MATCH_2}.0.0\\0" )
set( KICAD_WIN32_RC_FILEVER "${CMAKE_MATCH_1}, ${CMAKE_MATCH_2}, 0, 0" )
set( KICAD_WIN32_RC_FILEVER_STR "${CMAKE_MATCH_1}.${CMAKE_MATCH_2}.0.${KICAD_GIT_REV}\\0" )
set( KICAD_WIN32_RC_FILEVER "${CMAKE_MATCH_1}, ${CMAKE_MATCH_2}, 0, ${KICAD_GIT_REV}" )
set( KICAD_WIN32_RC_PRODVER_STR "${CMAKE_MATCH_1}.${CMAKE_MATCH_2}\\0" )
set( KICAD_WIN32_RC_PRODVER "${CMAKE_MATCH_1}, ${CMAKE_MATCH_2}, 0, 0" )
set( KICAD_WIN32_RC_PRODVER "${CMAKE_MATCH_1}, ${CMAKE_MATCH_2}, 0, ${KICAD_GIT_REV}" )
else()
message( FATAL_ERROR "Unable to extract major and minor version string" )
endif()

View File

@ -42,6 +42,15 @@ macro( create_git_version_header _git_src_path )
RESULT_VARIABLE _git_log_result
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(
COMMAND
${GIT_EXECUTABLE} rev-list --count --first-parent HEAD
WORKING_DIRECTORY ${_git_src_path}
OUTPUT_VARIABLE _git_REV_COUNT
ERROR_VARIABLE _git_log_error
RESULT_VARIABLE _git_log_result
OUTPUT_STRIP_TRAILING_WHITESPACE)
set( ENV{LC_ALL} ${_Git_SAVED_LC_ALL} )
endif( GIT_FOUND )
@ -49,6 +58,7 @@ macro( create_git_version_header _git_src_path )
# to KiCadVersion.cmake as the revision level.
if( _git_DESCRIBE )
set( KICAD_VERSION "(${_git_DESCRIBE})" )
set( KICAD_GIT_REV "${_git_REV_COUNT}" )
endif()
endmacro()