Added winpr version macro (same as freerdp version)

This commit is contained in:
Armin Novak 2019-08-22 15:54:18 +02:00
parent c3a124b0e2
commit da52297913

View File

@ -47,12 +47,30 @@ include(GNUInstallDirsWrapper)
include(CMakePackageConfigHelpers) include(CMakePackageConfigHelpers)
# Soname versioning # Soname versioning
set(WINPR_VERSION_MAJOR "2") set(RAW_VERSION_STRING "2.0.0-dev5")
set(WINPR_VERSION_MINOR "0") if(EXISTS "${CMAKE_SOURCE_DIR}/.source_tag")
set(WINPR_VERSION_REVISION "0") file(READ ${CMAKE_SOURCE_DIR}/.source_tag RAW_VERSION_STRING)
elseif(USE_VERSION_FROM_GIT_TAG)
git_get_exact_tag(_GIT_TAG --tags --always)
if (NOT ${_GIT_TAG} STREQUAL "n/a")
set(RAW_VERSION_STRING ${_GIT_TAG})
endif()
endif()
string(STRIP ${RAW_VERSION_STRING} RAW_VERSION_STRING)
set(VERSION_REGEX "^.?([0-9]+)\\.([0-9]+)\\.([0-9]+)-?(.*)")
string(REGEX REPLACE "${VERSION_REGEX}" "\\1" WINPR_VERSION_MAJOR "${RAW_VERSION_STRING}")
string(REGEX REPLACE "${VERSION_REGEX}" "\\2" WINPR_VERSION_MINOR "${RAW_VERSION_STRING}")
string(REGEX REPLACE "${VERSION_REGEX}" "\\3" WINPR_VERSION_REVISION "${RAW_VERSION_STRING}")
string(REGEX REPLACE "${VERSION_REGEX}" "\\4" WINPR_VERSION_SUFFIX "${RAW_VERSION_STRING}")
set(WINPR_VERSION "${WINPR_VERSION_MAJOR}.${WINPR_VERSION_MINOR}.${WINPR_VERSION_REVISION}") set(WINPR_VERSION "${WINPR_VERSION_MAJOR}.${WINPR_VERSION_MINOR}.${WINPR_VERSION_REVISION}")
set(WINPR_VERSION_FULL "${WINPR_VERSION}")
set(WINPR_API_VERSION "${WINPR_VERSION_MAJOR}") set(WINPR_API_VERSION "${WINPR_VERSION_MAJOR}")
if (WINPR_VERSION_SUFFIX)
set(WINPR_VERSION_FULL "${WINPR_VERSION}-${WINPR_VERSION_SUFFIX}")
else()
set(WINPR_VERSION_FULL "${WINPR_VERSION}")
endif()
if(NOT IOS) if(NOT IOS)
check_include_files(stdbool.h WINPR_HAVE_STDBOOL_H) check_include_files(stdbool.h WINPR_HAVE_STDBOOL_H)