summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake')
-rw-r--r--cmake/build_configurations/mysql_release.cmake29
-rw-r--r--cmake/do_abi_check.cmake30
-rw-r--r--cmake/dtrace.cmake12
-rw-r--r--cmake/maintainer.cmake54
-rw-r--r--cmake/mysql_version.cmake18
-rw-r--r--cmake/plugin.cmake2
6 files changed, 112 insertions, 33 deletions
diff --git a/cmake/build_configurations/mysql_release.cmake b/cmake/build_configurations/mysql_release.cmake
index 56a6d897318..91d598db465 100644
--- a/cmake/build_configurations/mysql_release.cmake
+++ b/cmake/build_configurations/mysql_release.cmake
@@ -117,19 +117,26 @@ IF(UNIX)
OPTION(WITH_PIC "" ON) # Why?
- # Ensure aio is available on Linux (required by InnoDB)
IF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
- CHECK_INCLUDE_FILES(libaio.h HAVE_LIBAIO_H)
- CHECK_LIBRARY_EXISTS(aio io_queue_init "" HAVE_LIBAIO)
- IF(NOT HAVE_LIBAIO_H OR NOT HAVE_LIBAIO)
- MESSAGE(FATAL_ERROR "
- aio is required on Linux, you need to install the required library:
-
- Debian/Ubuntu: apt-get install libaio-dev
- RedHat/Fedora/Oracle Linux: yum install libaio-devel
- SuSE: zypper install libaio-devel
- ")
+ IF(NOT IGNORE_AIO_CHECK)
+ # Ensure aio is available on Linux (required by InnoDB)
+ CHECK_INCLUDE_FILES(libaio.h HAVE_LIBAIO_H)
+ CHECK_LIBRARY_EXISTS(aio io_queue_init "" HAVE_LIBAIO)
+ IF(NOT HAVE_LIBAIO_H OR NOT HAVE_LIBAIO)
+ MESSAGE(FATAL_ERROR "
+ aio is required on Linux, you need to install the required library:
+
+ Debian/Ubuntu: apt-get install libaio-dev
+ RedHat/Fedora/Oracle Linux: yum install libaio-devel
+ SuSE: zypper install libaio-devel
+
+ If you really do not want it, pass -DIGNORE_AIO_CHECK to cmake.
+ ")
+ ENDIF()
ENDIF()
+
+ # Enable fast mutexes on Linux
+ OPTION(WITH_FAST_MUTEXES "" ON)
ENDIF()
ENDIF()
diff --git a/cmake/do_abi_check.cmake b/cmake/do_abi_check.cmake
index 78006bd018c..96943e1a4c4 100644
--- a/cmake/do_abi_check.cmake
+++ b/cmake/do_abi_check.cmake
@@ -53,23 +53,27 @@
SET(abi_check_out ${BINARY_DIR}/abi_check.out)
FOREACH(file ${ABI_HEADERS})
- SET(tmpfile ${file}.pp.tmp)
- EXECUTE_PROCESS(
- COMMAND ${COMPILER}
- -E -nostdinc -dI -DMYSQL_ABI_CHECK -I${SOURCE_DIR}/include
- -I${BINARY_DIR}/include -I${SOURCE_DIR}/include/mysql -I${SOURCE_DIR}/sql
- ${file}
- ERROR_QUIET OUTPUT_FILE ${tmpfile})
- EXECUTE_PROCESS(
- COMMAND sed -e
- "/^# /d" -e "/^[ ]*$/d" -e "/^#pragma GCC set_debug_pwd/d" -e "/^#ident/d"
- RESULT_VARIABLE result OUTPUT_FILE ${abi_check_out} INPUT_FILE ${tmpfile})
+ GET_FILENAME_COMPONENT(header_basename ${file} NAME)
+ SET(tmpfile ${BINARY_DIR}/${header_basename}.pp.tmp)
+
+ EXECUTE_PROCESS(
+ COMMAND ${COMPILER}
+ -E -nostdinc -dI -DMYSQL_ABI_CHECK -I${SOURCE_DIR}/include
+ -I${BINARY_DIR}/include -I${SOURCE_DIR}/include/mysql -I${SOURCE_DIR}/sql
+ ${file}
+ ERROR_QUIET OUTPUT_FILE ${tmpfile})
+ EXECUTE_PROCESS(
+ COMMAND sed -e "/^# /d"
+ -e "/^[ ]*$/d"
+ -e "/^#pragma GCC set_debug_pwd/d"
+ -e "/^#ident/d"
+ RESULT_VARIABLE result OUTPUT_FILE ${abi_check_out} INPUT_FILE ${tmpfile})
IF(NOT ${result} EQUAL 0)
MESSAGE(FATAL_ERROR "sed returned error ${result}")
ENDIF()
FILE(REMOVE ${tmpfile})
- EXECUTE_PROCESS(COMMAND diff -w ${file}.pp ${abi_check_out} RESULT_VARIABLE
- result)
+ EXECUTE_PROCESS(
+ COMMAND diff -w ${file}.pp ${abi_check_out} RESULT_VARIABLE result)
IF(NOT ${result} EQUAL 0)
MESSAGE(FATAL_ERROR
"ABI check found difference between ${file}.pp and ${abi_check_out}")
diff --git a/cmake/dtrace.cmake b/cmake/dtrace.cmake
index c12a74cba31..5beb45ca524 100644
--- a/cmake/dtrace.cmake
+++ b/cmake/dtrace.cmake
@@ -153,13 +153,23 @@ ENDFUNCTION()
# to mysqld.
MACRO (DTRACE_INSTRUMENT_STATIC_LIBS target libs)
IF(CMAKE_SYSTEM_NAME MATCHES "SunOS" AND ENABLE_DTRACE)
+ # Filter out non-static libraries in the list, if any
+ SET(static_libs)
FOREACH(lib ${libs})
+ GET_TARGET_PROPERTY(libtype ${lib} TYPE)
+ IF(libtype MATCHES STATIC_LIBRARY)
+ SET(static_libs ${static_lics} ${lib})
+ ENDIF()
+ ENDFOREACH()
+
+ FOREACH(lib ${static_libs})
SET(dirs ${dirs} ${TARGET_OBJECT_DIRECTORY_${lib}})
ENDFOREACH()
+
SET (obj ${CMAKE_CURRENT_BINARY_DIR}/${target}_dtrace_all.o)
ADD_CUSTOM_COMMAND(
OUTPUT ${obj}
- DEPENDS ${libs}
+ DEPENDS ${static_libs}
COMMAND ${CMAKE_COMMAND}
-DDTRACE=${DTRACE}
-DOUTFILE=${obj}
diff --git a/cmake/maintainer.cmake b/cmake/maintainer.cmake
new file mode 100644
index 00000000000..468b2f40084
--- /dev/null
+++ b/cmake/maintainer.cmake
@@ -0,0 +1,54 @@
+# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+#
+# 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
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+INCLUDE(CheckCCompilerFlag)
+
+# Setup GCC (GNU C compiler) warning options.
+MACRO(SET_MYSQL_MAINTAINER_GNU_C_OPTIONS)
+ SET(MY_MAINTAINER_WARNINGS
+ "-Wall -Wextra -Wunused -Wwrite-strings -Wno-strict-aliasing -Werror")
+ CHECK_C_COMPILER_FLAG("-Wdeclaration-after-statement"
+ HAVE_DECLARATION_AFTER_STATEMENT)
+ IF(HAVE_DECLARATION_AFTER_STATEMENT)
+ SET(MY_MAINTAINER_DECLARATION_AFTER_STATEMENT
+ "-Wdeclaration-after-statement")
+ ENDIF()
+ SET(MY_MAINTAINER_C_WARNINGS
+ "${MY_MAINTAINER_WARNINGS} ${MY_MAINTAINER_DECLARATION_AFTER_STATEMENT}"
+ CACHE STRING "C warning options used in maintainer builds.")
+ # Do not make warnings in checks into errors.
+ SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Wno-error")
+ENDMACRO()
+
+# Setup G++ (GNU C++ compiler) warning options.
+MACRO(SET_MYSQL_MAINTAINER_GNU_CXX_OPTIONS)
+ SET(MY_MAINTAINER_CXX_WARNINGS
+ "${MY_MAINTAINER_WARNINGS} -Wno-unused-parameter"
+ CACHE STRING "C++ warning options used in maintainer builds.")
+ENDMACRO()
+
+# Setup ICC (Intel C Compiler) warning options.
+MACRO(SET_MYSQL_MAINTAINER_INTEL_C_OPTIONS)
+ SET(MY_MAINTAINER_WARNINGS "-Wcheck")
+ SET(MY_MAINTAINER_C_WARNINGS "${MY_MAINTAINER_WARNINGS}"
+ CACHE STRING "C warning options used in maintainer builds.")
+ENDMACRO()
+
+# Setup ICPC (Intel C++ Compiler) warning options.
+MACRO(SET_MYSQL_MAINTAINER_INTEL_CXX_OPTIONS)
+ SET(MY_MAINTAINER_CXX_WARNINGS "${MY_MAINTAINER_WARNINGS}"
+ CACHE STRING "C++ warning options used in maintainer builds.")
+ENDMACRO()
+
diff --git a/cmake/mysql_version.cmake b/cmake/mysql_version.cmake
index b4be85ff657..3ed93020e8a 100644
--- a/cmake/mysql_version.cmake
+++ b/cmake/mysql_version.cmake
@@ -21,17 +21,21 @@ SET(SHARED_LIB_MAJOR_VERSION "16")
SET(PROTOCOL_VERSION "10")
SET(DOT_FRM_VERSION "6")
+# Generate "something" to trigger cmake rerun when VERSION changes
+CONFIGURE_FILE(
+ ${CMAKE_SOURCE_DIR}/VERSION
+ ${CMAKE_BINARY_DIR}/VERSION.dep
+)
+
# Read value for a variable from VERSION.
MACRO(MYSQL_GET_CONFIG_VALUE keyword var)
IF(NOT ${var})
- IF (EXISTS ${CMAKE_SOURCE_DIR}/VERSION)
- FILE (STRINGS ${CMAKE_SOURCE_DIR}/VERSION str REGEX "^[ ]*${keyword}=")
- IF(str)
- STRING(REPLACE "${keyword}=" "" str ${str})
- STRING(REGEX REPLACE "[ ].*" "" str "${str}")
- SET(${var} ${str})
- ENDIF()
+ FILE (STRINGS ${CMAKE_SOURCE_DIR}/VERSION str REGEX "^[ ]*${keyword}=")
+ IF(str)
+ STRING(REPLACE "${keyword}=" "" str ${str})
+ STRING(REGEX REPLACE "[ ].*" "" str "${str}")
+ SET(${var} ${str})
ENDIF()
ENDIF()
ENDMACRO()
diff --git a/cmake/plugin.cmake b/cmake/plugin.cmake
index bf34407db25..c6dd3fc451f 100644
--- a/cmake/plugin.cmake
+++ b/cmake/plugin.cmake
@@ -123,7 +123,7 @@ MACRO(MYSQL_ADD_PLUGIN)
# Update mysqld dependencies
SET (MYSQLD_STATIC_PLUGIN_LIBS ${MYSQLD_STATIC_PLUGIN_LIBS}
- ${target} CACHE INTERNAL "" FORCE)
+ ${target} ${ARG_LINK_LIBRARIES} CACHE INTERNAL "" FORCE)
IF(ARG_MANDATORY)
SET(${with_var} ON CACHE INTERNAL "Link ${plugin} statically to the server"