1# Copyright (c) 2009, 2012, Oracle and/or its affiliates. 2# 3# This program is free software; you can redistribute it and/or modify 4# it under the terms of the GNU General Public License as published by 5# the Free Software Foundation; version 2 of the License. 6# 7# This program is distributed in the hope that it will be useful, 8# but WITHOUT ANY WARRANTY; without even the implied warranty of 9# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10# GNU General Public License for more details. 11# 12# You should have received a copy of the GNU General Public License 13# along with this program; if not, write to the Free Software 14# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA 15 16# 17# Global constants, only to be changed between major releases. 18# 19 20SET(SHARED_LIB_MAJOR_VERSION "19") 21SET(PROTOCOL_VERSION "10") 22SET(DOT_FRM_VERSION "6") 23 24# Generate "something" to trigger cmake rerun when VERSION changes 25CONFIGURE_FILE( 26 ${CMAKE_SOURCE_DIR}/VERSION 27 ${CMAKE_BINARY_DIR}/VERSION.dep 28) 29 30# Read value for a variable from VERSION. 31 32MACRO(MYSQL_GET_CONFIG_VALUE keyword var) 33 IF(NOT ${var}) 34 FILE (STRINGS ${CMAKE_SOURCE_DIR}/VERSION str REGEX "^[ ]*${keyword}=") 35 IF(str) 36 STRING(REPLACE "${keyword}=" "" str ${str}) 37 STRING(REGEX REPLACE "[ ].*" "" str "${str}") 38 SET(${var} ${str}) 39 ENDIF() 40 ENDIF() 41ENDMACRO() 42 43 44# Read mysql version for configure script 45 46MACRO(GET_MYSQL_VERSION) 47 MYSQL_GET_CONFIG_VALUE("MYSQL_VERSION_MAJOR" MAJOR_VERSION) 48 MYSQL_GET_CONFIG_VALUE("MYSQL_VERSION_MINOR" MINOR_VERSION) 49 MYSQL_GET_CONFIG_VALUE("MYSQL_VERSION_PATCH" PATCH_VERSION) 50 MYSQL_GET_CONFIG_VALUE("MYSQL_VERSION_EXTRA" EXTRA_VERSION) 51 MYSQL_GET_CONFIG_VALUE("SERVER_MATURITY" SERVER_MATURITY) 52 53IF(NOT "${MAJOR_VERSION}" MATCHES "[0-9]+" OR 54 NOT "${MINOR_VERSION}" MATCHES "[0-9]+" OR 55 NOT "${PATCH_VERSION}" MATCHES "[0-9]+") 56 MESSAGE(FATAL_ERROR "VERSION file cannot be parsed.") 57 ENDIF() 58 59 SET(VERSION "${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}${EXTRA_VERSION}") 60 MESSAGE(STATUS "MariaDB ${VERSION}") 61 SET(MYSQL_BASE_VERSION "${MAJOR_VERSION}.${MINOR_VERSION}" CACHE INTERNAL "MySQL Base version") 62 SET(MYSQL_NO_DASH_VERSION "${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}") 63 MATH(EXPR MYSQL_VERSION_ID "10000*${MAJOR_VERSION} + 100*${MINOR_VERSION} + ${PATCH_VERSION}") 64 MARK_AS_ADVANCED(VERSION MYSQL_VERSION_ID MYSQL_BASE_VERSION) 65 SET(CPACK_PACKAGE_VERSION_MAJOR ${MAJOR_VERSION}) 66 SET(CPACK_PACKAGE_VERSION_MINOR ${MINOR_VERSION}) 67 SET(CPACK_PACKAGE_VERSION_PATCH ${PATCH_VERSION}${EXTRA_VERSION}) 68ENDMACRO() 69 70# Get mysql version and other interesting variables 71GET_MYSQL_VERSION() 72 73# Maturity level 74string(TOUPPER ${SERVER_MATURITY} SERVER_MATURITY) 75SET(SERVER_MATURITY_LEVEL MariaDB_PLUGIN_MATURITY_${SERVER_MATURITY}) 76 77SET(MYSQL_TCP_PORT_DEFAULT 0) 78SET_IF_UNSET(MYSQL_TCP_PORT 3306) 79 80SET_IF_UNSET(COMPILATION_COMMENT "Source distribution") 81 82INCLUDE(package_name) 83IF(NOT CPACK_PACKAGE_FILE_NAME) 84 GET_PACKAGE_FILE_NAME(CPACK_PACKAGE_FILE_NAME) 85ENDIF() 86 87SET_IF_UNSET(CPACK_SOURCE_PACKAGE_FILE_NAME "mariadb-${VERSION}") 88SET_IF_UNSET(CPACK_PACKAGE_CONTACT "MariaDB Developers <maria-developers@lists.launchpad.net>") 89SET_IF_UNSET(CPACK_PACKAGE_VENDOR "MariaDB Foundation") 90SET_IF_UNSET(CPACK_PACKAGE_DESCRIPTION "${CPACK_PACKAGE_DESCRIPTION_SUMMARY} 91 92It is GPL v2 licensed, which means you can use the it free of charge under the 93conditions of the GNU General Public License Version 2 (http://www.gnu.org/licenses/). 94 95MariaDB documentation can be found at https://mariadb.com/kb 96MariaDB bug reports should be submitted through https://jira.mariadb.org 97 98") 99SET(CPACK_SOURCE_GENERATOR "TGZ") 100 101# Definitions for windows version resources 102SET(PRODUCTNAME "MariaDB Server") 103SET(COMPANYNAME ${CPACK_PACKAGE_VENDOR}) 104 105# Windows 'date' command has unpredictable output, so cannot rely on it to 106# set MYSQL_COPYRIGHT_YEAR - if someone finds a portable way to do so then 107# it might be useful 108#IF (WIN32) 109# EXECUTE_PROCESS(COMMAND "date" "/T" OUTPUT_VARIABLE TMP_DATE) 110# STRING(REGEX REPLACE "(..)/(..)/..(..).*" "\\3\\2\\1" MYSQL_COPYRIGHT_YEAR ${TMP_DATE}) 111IF(UNIX) 112 EXECUTE_PROCESS(COMMAND "date" "+%Y" OUTPUT_VARIABLE MYSQL_COPYRIGHT_YEAR OUTPUT_STRIP_TRAILING_WHITESPACE) 113ENDIF() 114 115# Add version information to the exe and dll files 116# Refer to http://msdn.microsoft.com/en-us/library/aa381058(VS.85).aspx 117# for more info. 118IF(MSVC) 119 # Tiny version is used to identify the build, it can be set with cmake -DTINY_VERSION=<number> 120 # to bzr revno for example (in the CI builds) 121 IF(NOT TINY_VERSION) 122 SET(TINY_VERSION "0") 123 ENDIF() 124 125 GET_FILENAME_COMPONENT(MYSQL_CMAKE_SCRIPT_DIR ${CMAKE_CURRENT_LIST_FILE} PATH) 126 127 SET(FILETYPE VFT_APP) 128 CONFIGURE_FILE(${MYSQL_CMAKE_SCRIPT_DIR}/versioninfo.rc.in 129 ${CMAKE_BINARY_DIR}/versioninfo_exe.rc) 130 131 SET(FILETYPE VFT_DLL) 132 CONFIGURE_FILE(${MYSQL_CMAKE_SCRIPT_DIR}/versioninfo.rc.in 133 ${CMAKE_BINARY_DIR}/versioninfo_dll.rc) 134 135 FUNCTION(ADD_VERSION_INFO target target_type sources_var) 136 IF("${target_type}" MATCHES "SHARED" OR "${target_type}" MATCHES "MODULE") 137 SET(rcfile ${CMAKE_BINARY_DIR}/versioninfo_dll.rc) 138 ELSEIF("${target_type}" MATCHES "EXE") 139 SET(rcfile ${CMAKE_BINARY_DIR}/versioninfo_exe.rc) 140 ENDIF() 141 SET(${sources_var} ${${sources_var}} ${rcfile} PARENT_SCOPE) 142 ENDFUNCTION() 143ELSE() 144 FUNCTION(ADD_VERSION_INFO) 145 ENDFUNCTION() 146ENDIF() 147