Merge pull request #3648 from Beep6581/versionfix2

Revision of CMake and related files to support meaningful git versions within our extensive use of branches and development builds. #3628
This commit is contained in:
Beep6581
2017-01-30 23:17:28 +01:00
committed by GitHub
27 changed files with 306 additions and 256 deletions

View File

@@ -19,45 +19,6 @@ else (WIN32)
endif (WIN32)
if (WIN32)
if (CMAKE_SIZEOF_VOID_P EQUAL 4)
set(BUILD_BIT_DEPTH 32)
# 32 bits builds has to be installable on 64 bits system, to support WinXP/64.
set(ARCHITECTURE_ALLOWED "x86 x64 ia64")
# installing in 32 bits mode even on 64 bits OS and architecture
set(INSTALL_MODE "")
# set part of the output archive name
set(SYSTEM_NAME "WinXP")
elseif (CMAKE_SIZEOF_VOID_P EQUAL 8)
set(BUILD_BIT_DEPTH 64)
# Restricting the 64 bits builds to 64 bits systems only
set(ARCHITECTURE_ALLOWED "x64 ia64")
# installing in 64 bits mode for all 64 bits processors, even for itanium architecture
set(INSTALL_MODE "x64 ia64")
# set part of the output archive name
set(SYSTEM_NAME "WinVista")
endif (CMAKE_SIZEOF_VOID_P EQUAL 4)
# If we find ReleaseInfo.cmake we use the info from there and don't need Git to be installed
find_file(REL_INFO_FILE ReleaseInfo.cmake PATHS "${PROJECT_SOURCE_DIR}" NO_DEFAULT_PATH)
if (REL_INFO_FILE STREQUAL REL_INFO_FILE-NOTFOUND)
# we look for the git command in this paths by order of preference
find_file(GIT_CMD git.exe HINTS ENV Path PATH_SUFFIXES ../)
# Fail if Git is not installed
if (GIT_CMD STREQUAL GIT_CMD-NOTFOUND)
message(FATAL_ERROR "git command not found!")
else ()
message(STATUS "git command found: ${GIT_CMD}")
endif ()
execute_process(COMMAND ${GIT_CMD} describe --tags --always OUTPUT_VARIABLE GIT_VERSION_WHOLE OUTPUT_STRIP_TRAILING_WHITESPACE WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}")
string(REGEX REPLACE "-.*" "" GIT_VERSION ${GIT_VERSION_WHOLE})
string(REGEX REPLACE ".*-(.*)-g.*" "\\1" GIT_TAGDISTANCE ${GIT_VERSION_WHOLE})
else (REL_INFO_FILE STREQUAL REL_INFO_FILE-NOTFOUND)
include("${PROJECT_SOURCE_DIR}/ReleaseInfo.cmake")
endif (REL_INFO_FILE STREQUAL REL_INFO_FILE-NOTFOUND)
configure_file ("${CMAKE_CURRENT_SOURCE_DIR}/../tools/win/InnoSetup/WindowsInnoSetup.iss.in" "${CMAKE_CURRENT_BINARY_DIR}/WindowsInnoSetup.iss")
install (FILES "${CMAKE_CURRENT_BINARY_DIR}/WindowsInnoSetup.iss" DESTINATION ${BINDIR})
endif (WIN32)