Added winpr version macro (same as freerdp version)
@@ -47,12 +47,30 @@ include(GNUInstallDirsWrapper)
include(CMakePackageConfigHelpers)
# Soname versioning
-set(WINPR_VERSION_MAJOR "2")
-set(WINPR_VERSION_MINOR "0")
-set(WINPR_VERSION_REVISION "0")
+set(RAW_VERSION_STRING "2.0.0-dev5")
+if(EXISTS "${CMAKE_SOURCE_DIR}/.source_tag")
+ 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_FULL "${WINPR_VERSION}")
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)
check_include_files(stdbool.h WINPR_HAVE_STDBOOL_H)
