MDEV-26579 - post-fix, fix standalone C/C build

This commit is contained in:
Vladislav Vaintroub
2021-09-16 13:36:51 +02:00
parent a3c9f6545d
commit 636ad5d804
2 changed files with 20 additions and 11 deletions

View File

@ -168,6 +168,26 @@ ELSE()
SET(MARIADB_CLIENT_VERSION_PATCH "5")
SET(MARIADB_CLIENT_VERSION_EXTRA "")
ENDIF()
IF(WIN32)
# version in resource files need to be consistent
# with server's , so that MSI minor upgrade work.
# if this is not a subproject build, C/C version is used.
FOREACH(v MAJOR MINOR PATCH TINY)
IF(DEFINED ${v}_VERSION)
SET(${v}_FILE_VERSION "${${v}_VERSION}")
ELSEIF(DEFINED CPACK_PACKAGE_VERSION_${v})
SET(${v}_FILE_VERSION "${CPACK_PACKAGE_VERSION_${v}}")
ELSE()
SET(${v}_FILE_VERSION "0")
ENDIF()
IF(NOT ${v}_FILE_VERSION MATCHES "^[0-9]+$")
MESSAGE(FATAL_ERROR
"${v}_FILE_VERSION is not numeric - '${${v}_FILE_VERSION}'")
ENDIF()
ENDFOREACH()
ENDIF()
SET(MARIADB_CLIENT_VERSION "${MARIADB_CLIENT_VERSION_MAJOR}.${MARIADB_CLIENT_VERSION_MINOR}.${MARIADB_CLIENT_VERSION_PATCH}${MARIADB_CLIENT_VERSION_EXTRA}")
SET(MARIADB_BASE_VERSION "mariadb-${MARIADB_CLIENT_VERSION_MAJOR}.${MARIADB_CLIENT_VERSION_MINOR}")
MATH(EXPR MARIADB_VERSION_ID "${MARIADB_CLIENT_VERSION_MAJOR} * 10000 +

View File

@ -35,17 +35,6 @@ MACRO(SET_VERSION_INFO)
STRING(REPLACE "FILE_DESCRIPTION:" "" FILE_DESCRIPTION ${PROPERTY})
ENDIF()
ENDFOREACH()
# Connector can be packaged with server, so set the "file version"
# to the server version
# In this case, numeric file version should be consistent with server
# Only this way MSI minor upgrade can work.
# The product version string will still refer to Connectors own version
IF((NOT DEFINED MAJOR_VERSION) OR (NOT DEFINED MINOR_VERSION) OR (NOT DEFINED PATCH_VERSION) OR (NOT DEFINED TINY_VERSION))
SET(MAJOR_VERSION ${CPACK_PACKAGE_VERSION_MAJOR})
SET(MINOR_VERSION ${CPACK_PACKAGE_VERSION_MINOR})
SET(PATCH_VERSION ${CPACK_PACKAGE_VERSION_PATCH})
SET(TINY_VERSION ${FILE_VERSION})
ENDIF()
CONFIGURE_FILE(${CC_SOURCE_DIR}/win/resource.rc.in
${CC_BINARY_DIR}/win/${TARGET}.rc)
SET(${TARGET}_RC ${CC_BINARY_DIR}/win/${TARGET}.rc)