1# Copyright (c) 2011, Codership Oy <info@codership.com>.
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-1301  USA
15
16# We need to generate a proper spec file even without --with-wsrep flag,
17# so WSREP_VERSION is produced regardless
18
19# Set the patch version
20SET(WSREP_PATCH_VERSION "27")
21
22# Obtain patch revision number
23SET(WSREP_REVISION $ENV{WSREP_REV})
24IF(NOT WSREP_REVISION)
25  SET(WSREP_REVISION "XXXX" CACHE STRING "WSREP revision")
26ENDIF()
27
28
29# Obtain wsrep API version
30EXECUTE_PROCESS(
31  COMMAND sh -c "grep WSREP_INTERFACE_VERSION ${MySQL_SOURCE_DIR}/wsrep/src/wsrep_api.h | cut -d '\"' -f 2"
32  OUTPUT_VARIABLE WSREP_API_VERSION
33  RESULT_VARIABLE RESULT
34)
35#FILE(WRITE "wsrep_config" "Debug: WSREP_API_VERSION result: ${RESULT}\n")
36STRING(REGEX REPLACE "(\r?\n)+$" "" WSREP_API_VERSION "${WSREP_API_VERSION}")
37
38SET(WSREP_VERSION "${WSREP_API_VERSION}.${WSREP_PATCH_VERSION}"
39  CACHE STRING "WSREP version")
40
41OPTION(WITH_WSREP "WSREP replication API (to use, e.g. Galera Replication library)" OFF)
42IF (WITH_WSREP)
43  SET(WSREP_C_FLAGS   "-DWITH_WSREP -DWSREP_PROC_INFO -DMYSQL_MAX_VARIABLE_VALUE_LEN=4096")
44  SET(CMAKE_C_FLAGS   "${CMAKE_C_FLAGS} ${WSREP_C_FLAGS}")
45  SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WSREP_C_FLAGS}")
46  SET(COMPILATION_COMMENT "${COMPILATION_COMMENT}, wsrep_${WSREP_VERSION}")
47  SET(WITH_EMBEDDED_SERVER OFF)
48  SET(WITH_INNODB_DISALLOW_WRITES ON)
49  SET(WITH_INNODB_MEMCACHED ON)
50ENDIF()
51
52#
53