diff options
author | Vladislav Vaintroub <wlad@montyprogram.com> | 2011-05-12 15:34:02 +0200 |
---|---|---|
committer | Vladislav Vaintroub <wlad@montyprogram.com> | 2011-05-12 15:34:02 +0200 |
commit | 83ce12ba699468dbb9477803a741dfaba426e7f7 (patch) | |
tree | 9b7f238742c88305c6dd769010f74adcfd0fb324 /CMakeLists.txt | |
parent | 1c95254523954637ae1904c436916ed1da13f378 (diff) | |
download | mariadb-git-83ce12ba699468dbb9477803a741dfaba426e7f7.tar.gz |
Windows build : Make win\config.js optional in 5.1
Simplifies handling 5.1 in buildbot.
Diffstat (limited to 'CMakeLists.txt')
-rwxr-xr-x | CMakeLists.txt | 93 |
1 files changed, 92 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 1e727080df2..4954e4a9d07 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,98 @@ ENDIF(COMMAND cmake_policy) PROJECT(MySql) # This reads user configuration, generated by configure.js. -INCLUDE(win/configure.data) +INCLUDE(win/configure.data OPTIONAL) + +MACRO(MYSQL_GET_CONFIG_VALUE keyword var) + IF(NOT ${var}) + IF (EXISTS ${CMAKE_SOURCE_DIR}/configure.in) + FILE (STRINGS ${CMAKE_SOURCE_DIR}/configure.in str REGEX "^[ ]*${keyword}=") + IF(str) + STRING(REPLACE "${keyword}=" "" str ${str}) + STRING(REGEX REPLACE "[ ].*" "" str ${str}) + SET(${var} ${str} CACHE INTERNAL "Config variable") + ENDIF() + ENDIF() + ENDIF() +ENDMACRO() + + +# Read mysql version for configure script + +MACRO(GET_MYSQL_VERSION) + IF(NOT VERSION_STRING) + IF(EXISTS ${CMAKE_SOURCE_DIR}/configure.in) + FILE(STRINGS ${CMAKE_SOURCE_DIR}/configure.in str REGEX "AM_INIT_AUTOMAKE") + STRING(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+[-][^ \\)]+" VERSION_STRING "${str}") + IF(NOT VERSION_STRING) + STRING(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" VERSION_STRING "${str}") + IF(NOT VERSION_STRING) + FILE(STRINGS configure.in str REGEX "AC_INIT\\(") + STRING(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+[-][a-zA-Z0-9]+" VERSION_STRING "${str}") + IF(NOT VERSION_STRING) + STRING(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" VERSION_STRING "${str}") + ENDIF() + ENDIF() + ENDIF() + ENDIF() + ENDIF() + + IF(NOT VERSION_STRING) + MESSAGE(FATAL_ERROR + "VERSION_STRING cannot be parsed, please specify -DVERSION_STRING=major.minor.patch-extra" + "when calling cmake") + ENDIF() + + SET(VERSION ${VERSION_STRING}) + STRING(REPLACE "-" "_" MYSQL_U_SCORE_VERSION "${VERSION_STRING}") + + # Remove trailing (non-numeric) part of the version string + STRING(REGEX REPLACE "[^\\.0-9].*" "" VERSION_STRING ${VERSION_STRING}) + + STRING(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" MAJOR_VERSION "${VERSION_STRING}") + STRING(REGEX REPLACE "[0-9]+\\.([0-9]+)\\.[0-9]+" "\\1" MINOR_VERSION "${VERSION_STRING}") + STRING(REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" PATCH "${VERSION_STRING}") + SET(MYSQL_BASE_VERSION "${MAJOR_VERSION}.${MINOR_VERSION}" CACHE INTERNAL "MySQL Base version") + SET(MYSQL_NO_DASH_VERSION "${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH}") + MATH(EXPR MYSQL_VERSION_ID "10000*${MAJOR_VERSION} + 100*${MINOR_VERSION} + ${PATCH}") + MARK_AS_ADVANCED(VERSION MYSQL_VERSION_ID MYSQL_BASE_VERSION) + SET(CPACK_PACKAGE_VERSION_MAJOR ${MAJOR_VERSION}) + SET(CPACK_PACKAGE_VERSION_MINOR ${MINOR_VERSION}) + SET(CPACK_PACKAGE_VERSION_PATCH ${PATCH}) +ENDMACRO() + +# Get mysql version and other interesting variables +GET_MYSQL_VERSION() + +MYSQL_GET_CONFIG_VALUE("PROTOCOL_VERSION" PROTOCOL_VERSION) +MYSQL_GET_CONFIG_VALUE("DOT_FRM_VERSION" DOT_FRM_VERSION) +MYSQL_GET_CONFIG_VALUE("MYSQL_TCP_PORT_DEFAULT" MYSQL_TCP_PORT_DEFAULT) +MYSQL_GET_CONFIG_VALUE("MYSQL_UNIX_ADDR_DEFAULT" MYSQL_UNIX_ADDR_DEFAULT) +MYSQL_GET_CONFIG_VALUE("SHARED_LIB_MAJOR_VERSION" SHARED_LIB_MAJOR_VERSION) +IF(NOT MYSQL_TCP_PORT_DEFAULT) + SET(MYSQL_TCP_PORT_DEFAULT "3306") +ENDIF() +IF(NOT MYSQL_TCP_PORT) + SET(MYSQL_TCP_PORT ${MYSQL_TCP_PORT_DEFAULT}) + SET(MYSQL_TCP_PORT_DEFAULT "0") +ELSEIF(MYSQL_TCP_PORT EQUAL MYSQL_TCP_PORT_DEFAULT) + SET(MYSQL_TCP_PORT_DEFAULT "0") +ENDIF() + + +IF(NOT MYSQL_UNIX_ADDR) + SET(MYSQL_UNIX_ADDR "/tmp/mysql.sock") +ENDIF() +IF(NOT COMPILATION_COMMENT) + SET(COMPILATION_COMMENT "Source distribution") +ENDIF() + +SET(WITH_EXAMPLE_STORAGE_ENGINE TRUE) +SET(WITH_FEDERATEDX_STORAGE_ENGINE TRUE) +SET(WITH_PARTITION_STORAGE_ENGINE TRUE) +SET(WITH_MARIA_STORAGE_ENGINE TRUE) +SET(WITH_PBXT_STORAGE_ENGINE TRUE) +SET(WITH_XTRADB_STORAGE_ENGINE TRUE) # Hardcode support for CSV storage engine SET(WITH_CSV_STORAGE_ENGINE TRUE) |