summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt89
1 files changed, 40 insertions, 49 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 05e3c52f1e4..097d79fa5e7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,5 +1,5 @@
# Copyright (c) 2006, 2017, Oracle and/or its affiliates.
-# Copyright (c) 2008, 2018, MariaDB Corporation
+# Copyright (c) 2008, 2019, MariaDB Corporation.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -14,11 +14,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA
-CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-# Avoid warnings in higher versions
-if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 2.6)
- CMAKE_POLICY(VERSION 2.8)
-endif()
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8.5)
# explicitly set the policy to OLD
# (cannot use NEW, not everyone is on cmake-2.8.12 yet)
@@ -35,16 +31,14 @@ IF(CMAKE_VERSION VERSION_EQUAL "3.0.0" OR
CMAKE_POLICY(SET CMP0045 OLD)
CMAKE_POLICY(SET CMP0042 OLD)
ENDIF()
+IF(POLICY CMP0054)
+ CMAKE_POLICY(SET CMP0054 NEW)
+ENDIF()
MESSAGE(STATUS "Running cmake version ${CMAKE_VERSION}")
-SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake)
-
-# Distinguish between community and non-community builds, with the
-# default being a community build. This does not impact the feature
-# set that will be compiled in; it's merely provided as a hint to
-# custom packaging steps.
-OPTION(COMMUNITY_BUILD "Set to true if this is a community build" ON)
+SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
+ ${CMAKE_SOURCE_DIR}/cmake ${CMAKE_SOURCE_DIR}/cmake/Internal/CPack)
# Use a default manufacturer if no manufacturer was identified.
IF(NOT DEFINED MANUFACTURER)
@@ -122,6 +116,11 @@ FOREACH(_base
ENDIF()
ENDFOREACH()
+FOREACH(tool gtar tar git)
+ STRING(TOUPPER ${tool} TOOL)
+ FIND_PROGRAM(${TOOL}_EXECUTABLE ${tool} DOC "path to the executable")
+ MARK_AS_ADVANCED(${TOOL}_EXECUTABLE)
+ENDFOREACH()
# Following autotools tradition, add preprocessor definitions
# specified in environment variable CPPFLAGS
@@ -140,6 +139,7 @@ IF (NOT CPACK_GENERATOR)
ENDIF(WIN32)
ENDIF(NOT CPACK_GENERATOR)
+INCLUDE(misc)
INCLUDE(mysql_version)
INCLUDE(cpack_source_ignore_files)
INCLUDE(install_layout)
@@ -153,7 +153,6 @@ INCLUDE(ssl)
INCLUDE(readline)
INCLUDE(libutils)
INCLUDE(dtrace)
-INCLUDE(jemalloc)
INCLUDE(pcre)
INCLUDE(ctest)
INCLUDE(plugin)
@@ -161,6 +160,7 @@ INCLUDE(install_macros)
INCLUDE(systemd)
INCLUDE(mysql_add_executable)
INCLUDE(compile_flags)
+INCLUDE(crc32-vpmsum)
# Handle options
OPTION(DISABLE_SHARED
@@ -169,13 +169,11 @@ IF(DISABLE_SHARED)
SET(WITHOUT_DYNAMIC_PLUGINS 1)
ENDIF()
OPTION(ENABLED_PROFILING "Enable profiling" ON)
-OPTION(CYBOZU "" OFF)
OPTION(WITHOUT_SERVER "Build only the client library and clients" OFF)
IF(UNIX)
OPTION(WITH_VALGRIND "Valgrind instrumentation" OFF)
ENDIF()
OPTION (WITH_UNIT_TESTS "Compile MySQL with unit tests" ON)
-MARK_AS_ADVANCED(CYBOZU)
IF (WITHOUT_SERVER)
SET (SKIP_COMPONENTS "Server|IniFiles|SuportFiles|Readme")
@@ -192,18 +190,18 @@ IF (WITH_ASAN)
# this flag might be set by default on some OS
MY_CHECK_AND_SET_COMPILER_FLAG("-U_FORTIFY_SOURCE" DEBUG RELWITHDEBINFO)
# gcc 4.8.1 and new versions of clang
- MY_CHECK_AND_SET_COMPILER_FLAG("-fsanitize=address -O1 -Wno-error -fPIC"
+ MY_CHECK_AND_SET_COMPILER_FLAG("-fsanitize=address -fPIC"
DEBUG RELWITHDEBINFO)
- SET(HAVE_C_FSANITIZE ${HAVE_C__fsanitize_address__O1__Wno_error__fPIC})
- SET(HAVE_CXX_FSANITIZE ${HAVE_CXX__fsanitize_address__O1__Wno_error__fPIC})
+ SET(HAVE_C_FSANITIZE ${have_C__fsanitize_address__fPIC})
+ SET(HAVE_CXX_FSANITIZE ${have_CXX__fsanitize_address__fPIC})
IF(HAVE_C_FSANITIZE AND HAVE_CXX_FSANITIZE)
SET(WITH_ASAN_OK 1)
ELSE()
# older versions of clang
- MY_CHECK_AND_SET_COMPILER_FLAG("-faddress-sanitizer -O1 -fPIC"
+ MY_CHECK_AND_SET_COMPILER_FLAG("-faddress-sanitizer -fPIC"
DEBUG RELWITHDEBINFO)
- SET(HAVE_C_FADDRESS ${HAVE_C__faddress_sanitizer__O1__fPIC})
- SET(HAVE_CXX_FADDRESS ${HAVE_CXX__faddress_sanitizer__O1__fPIC})
+ SET(HAVE_C_FADDRESS ${have_C__faddress_sanitizer__fPIC})
+ SET(HAVE_CXX_FADDRESS ${have_CXX__faddress_sanitizer__fPIC})
IF(HAVE_C_FADDRESS AND HAVE_CXX_FADDRESS)
SET(WITH_ASAN_OK 1)
ENDIF()
@@ -216,9 +214,13 @@ ENDIF()
OPTION(WITH_UBSAN "Enable undefined behavior sanitizer" OFF)
IF (WITH_UBSAN)
- MY_CHECK_AND_SET_COMPILER_FLAG("-fsanitize=undefined -U_FORTIFY_SOURCE" DEBUG RELWITHDEBINFO)
+ MY_CHECK_AND_SET_COMPILER_FLAG("-fsanitize=undefined -fno-sanitize=alignment -U_FORTIFY_SOURCE -DWITH_UBSAN" DEBUG RELWITHDEBINFO)
ENDIF()
+OPTION(WITH_MSAN "Enable memory sanitizer" OFF)
+IF (WITH_MSAN)
+ MY_CHECK_AND_SET_COMPILER_FLAG("-fsanitize=memory -fsanitize-memory-track-origins -U_FORTIFY_SOURCE" DEBUG RELWITHDEBINFO)
+ENDIF()
# enable security hardening features, like most distributions do
# in our benchmarks that costs about ~1% of performance, depending on the load
@@ -239,6 +241,11 @@ IF(SECURITY_HARDENED)
MY_CHECK_AND_SET_COMPILER_FLAG("-D_FORTIFY_SOURCE=2" RELEASE RELWITHDEBINFO)
ENDIF()
+OPTION(WITH_DBUG_TRACE "Enable DBUG_ENTER()/DBUG_EXIT()" ON)
+IF(WITH_DBUG_TRACE)
+ ADD_DEFINITIONS(-DDBUG_TRACE)
+ENDIF()
+
# Always enable debug sync for debug builds.
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DENABLED_DEBUG_SYNC")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DENABLED_DEBUG_SYNC")
@@ -259,15 +266,6 @@ ELSEIF (NOT ENABLED_LOCAL_INFILE MATCHES "^(ON|OFF|AUTO)$")
MESSAGE(FATAL_ERROR "ENABLED_LOCAL_INFILE must be one of OFF, ON, AUTO")
ENDIF()
-OPTION(WITH_FAST_MUTEXES "Compile with fast mutexes" OFF)
-MARK_AS_ADVANCED(WITH_FAST_MUTEXES)
-
-OPTION(WITH_INNODB_DISALLOW_WRITES "InnoDB freeze writes patch from Google" ${WITH_WSREP})
-IF (WITH_INNODB_DISALLOW_WRITES)
- SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWITH_INNODB_DISALLOW_WRITES")
- SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DWITH_INNODB_DISALLOW_WRITES")
-ENDIF()
-
# Set DBUG_OFF and other optional release-only flags for non-debug project types
FOREACH(BUILD_TYPE RELEASE RELWITHDEBINFO MINSIZEREL)
FOREACH(LANG C CXX)
@@ -276,16 +274,12 @@ FOREACH(BUILD_TYPE RELEASE RELWITHDEBINFO MINSIZEREL)
SET(CMAKE_${LANG}_FLAGS_${BUILD_TYPE}
"${CMAKE_${LANG}_FLAGS_${BUILD_TYPE}} -DDBUG_OFF")
ENDIF()
- IF(WITH_FAST_MUTEXES)
- SET(CMAKE_${LANG}_FLAGS_${BUILD_TYPE}
- "${CMAKE_${LANG}_FLAGS_${BUILD_TYPE}} -DMY_PTHREAD_FASTMUTEX=1")
- ENDIF()
ENDFOREACH()
ENDFOREACH()
# Add safemutex for debug configurations, except on Windows
# (safemutex has never worked on Windows)
-IF(NOT WIN32 AND NOT WITH_INNODB_MEMCACHED)
+IF(NOT WIN32)
FOREACH(LANG C CXX)
SET(CMAKE_${LANG}_FLAGS_DEBUG "${CMAKE_${LANG}_FLAGS_DEBUG} -DSAFE_MUTEX")
ENDFOREACH()
@@ -318,7 +312,7 @@ ELSE()
ENDIF()
SET(DEFAULT_CHARSET_HOME "${DEFAULT_MYSQL_HOME}")
SET(PLUGINDIR "${DEFAULT_MYSQL_HOME}/${INSTALL_PLUGINDIR}")
-IF(INSTALL_SYSCONFDIR AND NOT DEFAULT_SYSCONFDIR)
+IF(INSTALL_SYSCONFDIR AND NOT DEFAULT_SYSCONFDIR AND NOT DEB)
SET(DEFAULT_SYSCONFDIR "${INSTALL_SYSCONFDIR}")
ENDIF()
@@ -342,7 +336,7 @@ IF(NOT HAVE_CXX_NEW)
ENDIF()
# Find header files from the bundled libraries
-# (jemalloc, yassl, readline, pcre, etc)
+# (yassl, readline, pcre, etc)
# before the ones installed in the system
SET(CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE ON)
@@ -361,7 +355,7 @@ MYSQL_CHECK_SSL()
MYSQL_CHECK_READLINE()
SET(MALLOC_LIBRARY "system")
-CHECK_JEMALLOC()
+SET(PYTHON_SHEBANG "/usr/bin/env python")
CHECK_PCRE()
@@ -388,6 +382,7 @@ IF(WITH_UNIT_TESTS)
ADD_SUBDIRECTORY(unittest/examples)
ADD_SUBDIRECTORY(unittest/mysys)
ADD_SUBDIRECTORY(unittest/my_decimal)
+ ADD_SUBDIRECTORY(unittest/json_lib)
IF(NOT WITHOUT_SERVER)
ADD_SUBDIRECTORY(unittest/sql)
ENDIF()
@@ -397,6 +392,10 @@ INCLUDE(cpack_rpm)
INCLUDE(cpack_deb)
SET (MYSQLD_STATIC_PLUGIN_LIBS "" CACHE INTERNAL "")
+
+INCLUDE(submodules)
+INCLUDE(mariadb_connector_c) # this does ADD_SUBDIRECTORY(libmariadb)
+
# Add storage engines and plugins.
CONFIGURE_PLUGINS()
@@ -406,7 +405,6 @@ ADD_SUBDIRECTORY(strings)
ADD_SUBDIRECTORY(vio)
ADD_SUBDIRECTORY(mysys)
ADD_SUBDIRECTORY(mysys_ssl)
-ADD_SUBDIRECTORY(libmysql)
ADD_SUBDIRECTORY(client)
ADD_SUBDIRECTORY(extra)
ADD_SUBDIRECTORY(libservices)
@@ -468,12 +466,6 @@ CONFIGURE_FILE(
${CMAKE_SOURCE_DIR}/cmake/info_macros.cmake.in
${CMAKE_BINARY_DIR}/info_macros.cmake @ONLY)
-IF(DEB)
- CONFIGURE_FILE(
- ${CMAKE_SOURCE_DIR}/debian/mariadb-server-10.1.files.in
- ${CMAKE_SOURCE_DIR}/debian/mariadb-server-10.1.files)
-ENDIF(DEB)
-
# Handle the "INFO_*" files.
INCLUDE(${CMAKE_BINARY_DIR}/info_macros.cmake)
# Source: This can be done during the cmake phase, all information is
@@ -490,7 +482,7 @@ ADD_CUSTOM_TARGET(INFO_BIN ALL
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
)
-INSTALL_DOCUMENTATION(README CREDITS COPYING COPYING.thirdparty
+INSTALL_DOCUMENTATION(README.md CREDITS COPYING THIRDPARTY
EXCEPTIONS-CLIENT COMPONENT Readme)
# MDEV-6526 these files are not installed anymore
@@ -498,7 +490,6 @@ INSTALL_DOCUMENTATION(README CREDITS COPYING COPYING.thirdparty
# ${CMAKE_BINARY_DIR}/Docs/INFO_BIN)
IF(UNIX)
- INSTALL_DOCUMENTATION(Docs/INSTALL-BINARY COMPONENT Readme)
INSTALL_DOCUMENTATION(Docs/INSTALL-BINARY Docs/README-wsrep COMPONENT Readme)
ENDIF()