diff options
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/build_configurations/mysql_release.cmake | 19 | ||||
-rw-r--r-- | cmake/compile_flags.cmake | 44 | ||||
-rw-r--r-- | cmake/cpack_rpm.cmake | 1 | ||||
-rw-r--r-- | cmake/libutils.cmake | 2 | ||||
-rw-r--r-- | cmake/maintainer.cmake | 93 | ||||
-rw-r--r-- | cmake/os/Darwin.cmake | 21 | ||||
-rw-r--r-- | cmake/os/WindowsCache.cmake | 6 |
7 files changed, 105 insertions, 81 deletions
diff --git a/cmake/build_configurations/mysql_release.cmake b/cmake/build_configurations/mysql_release.cmake index 7e5ce563b15..02492f2dbc9 100644 --- a/cmake/build_configurations/mysql_release.cmake +++ b/cmake/build_configurations/mysql_release.cmake @@ -202,15 +202,16 @@ IF(UNIX) ENDIF() ENDIF() - # OSX flags - IF(APPLE) - SET(COMMON_C_FLAGS "-g -fno-common -fno-strict-aliasing") - # XXX: why are we using -felide-constructors on OSX? - SET(COMMON_CXX_FLAGS "-g -fno-common -felide-constructors -fno-strict-aliasing") - SET(CMAKE_C_FLAGS_DEBUG "-O ${COMMON_C_FLAGS}") - SET(CMAKE_CXX_FLAGS_DEBUG "-O ${COMMON_CXX_FLAGS}") - SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-Os ${COMMON_C_FLAGS}") - SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-Os ${COMMON_CXX_FLAGS}") + # Default Clang flags + IF(CMAKE_C_COMPILER_ID MATCHES "Clang") + SET(COMMON_C_FLAGS "-g -fno-omit-frame-pointer -fno-strict-aliasing") + SET(CMAKE_C_FLAGS_DEBUG "${COMMON_C_FLAGS}") + SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-O3 ${COMMON_C_FLAGS}") + ENDIF() + IF(CMAKE_CXX_COMPILER_ID MATCHES "Clang") + SET(COMMON_CXX_FLAGS "-g -fno-omit-frame-pointer -fno-strict-aliasing") + SET(CMAKE_CXX_FLAGS_DEBUG "${COMMON_CXX_FLAGS}") + SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 ${COMMON_CXX_FLAGS}") ENDIF() # Solaris flags diff --git a/cmake/compile_flags.cmake b/cmake/compile_flags.cmake new file mode 100644 index 00000000000..5e872f981b0 --- /dev/null +++ b/cmake/compile_flags.cmake @@ -0,0 +1,44 @@ +# Copyright (c) 2014, 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 + + +## ADD_COMPILE_FLAGS(<source files> COMPILE_FLAGS <flags>) +MACRO(ADD_COMPILE_FLAGS) + SET(FILES "") + SET(FLAGS "") + SET(COMPILE_FLAGS) + FOREACH(ARG ${ARGV}) + IF(ARG STREQUAL "COMPILE_FLAGS") + SET(COMPILE_FLAGS "COMPILE_FLAGS") + ELSEIF(COMPILE_FLAGS) + LIST(APPEND FLAGS ${ARG}) + ELSE() + LIST(APPEND FILES ${ARG}) + ENDIF() + ENDFOREACH() + FOREACH(FILE ${FILES}) + FOREACH(FLAG ${FLAGS}) + GET_SOURCE_FILE_PROPERTY(PROP ${FILE} COMPILE_FLAGS) + IF(NOT PROP) + SET(PROP ${FLAG}) + ELSE() + SET(PROP "${PROP} ${FLAG}") + ENDIF() + SET_SOURCE_FILES_PROPERTIES( + ${FILE} PROPERTIES COMPILE_FLAGS "${PROP}" + ) + ENDFOREACH() + ENDFOREACH() +ENDMACRO() diff --git a/cmake/cpack_rpm.cmake b/cmake/cpack_rpm.cmake index f777db21015..acbb017d75c 100644 --- a/cmake/cpack_rpm.cmake +++ b/cmake/cpack_rpm.cmake @@ -189,6 +189,7 @@ ELSEIF(RPM MATCHES "fedora" OR RPM MATCHES "(rhel|centos)7") ALTERNATIVE_NAME("client" "mysql") ALTERNATIVE_NAME("devel" "mariadb-devel") ALTERNATIVE_NAME("server" "mariadb-server") + ALTERNATIVE_NAME("server" "mysql-compat-server") ALTERNATIVE_NAME("shared" "mariadb-libs") ALTERNATIVE_NAME("shared" "mysql-libs") ALTERNATIVE_NAME("test" "mariadb-test") diff --git a/cmake/libutils.cmake b/cmake/libutils.cmake index 8f85b988f8d..8fcfe294f17 100644 --- a/cmake/libutils.cmake +++ b/cmake/libutils.cmake @@ -304,6 +304,8 @@ FUNCTION(GET_DEPENDEND_OS_LIBS target result) SET(${result} ${ret} PARENT_SCOPE) ENDFUNCTION() +INCLUDE(CheckCCompilerFlag) + SET(VISIBILITY_HIDDEN_FLAG) IF(CMAKE_COMPILER_IS_GNUCXX AND UNIX) diff --git a/cmake/maintainer.cmake b/cmake/maintainer.cmake index 874e05b8a43..872d61d9aac 100644 --- a/cmake/maintainer.cmake +++ b/cmake/maintainer.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2010, 2014, 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 @@ -13,51 +13,46 @@ # 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 -DFORCE_INIT_OF_VARS") - - CHECK_C_COMPILER_FLAG("-Wno-missing-field-initializers" - HAVE_NO_MISSING_FIELD_INITIALIZERS) - - IF (HAVE_NO_MISSING_FIELD_INITIALIZERS) - SET(MY_MAINTAINER_WARNINGS - "${MY_MAINTAINER_WARNINGS} -Wno-missing-field-initializers") - ENDIF() - - 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 INTERNAL "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-invalid-offsetof -Wno-unused-parameter -Woverloaded-virtual" - CACHE INTERNAL "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 INTERNAL "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 INTERNAL "C++ warning options used in maintainer builds.") -ENDMACRO() - +# Common warning flags for GCC, G++, Clang and Clang++ +SET(MY_WARNING_FLAGS "-Wall -Wextra -Wformat-security") +MY_CHECK_C_COMPILER_FLAG("-Wvla" HAVE_WVLA) # Requires GCC 4.3+ or Clang +IF(HAVE_WVLA) + SET(MY_WARNING_FLAGS "${MY_WARNING_FLAGS} -Wvla") +ENDIF() + +# Common warning flags for GCC and Clang +SET(MY_C_WARNING_FLAGS + "${MY_WARNING_FLAGS} -Wwrite-strings -Wdeclaration-after-statement") + +# Common warning flags for G++ and Clang++ +SET(MY_CXX_WARNING_FLAGS + "${MY_WARNING_FLAGS} -Woverloaded-virtual -Wno-unused-parameter") + +# Extra warning flags for Clang++ +IF(CMAKE_CXX_COMPILER_ID MATCHES "Clang") + SET(MY_CXX_WARNING_FLAGS + "${MY_CXX_WARNING_FLAGS} -Wno-null-conversion -Wno-unused-private-field") +ENDIF() + +# Turn on Werror (warning => error) when using maintainer mode. +IF(MYSQL_MAINTAINER_MODE MATCHES "ON") + SET(MY_C_WARNING_FLAGS "${MY_C_WARNING_FLAGS} -DFORCE_INIT_OF_VARS -Werror") + SET(MY_CXX_WARNING_FLAGS "${MY_CXX_WARNING_FLAGS} -DFORCE_INIT_OF_VARS -Werror") +ENDIF() + +# Set warning flags for GCC/Clang +IF(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang") + SET(MY_MAINTAINER_C_WARNINGS "${MY_C_WARNING_FLAGS}") +ENDIF() +# Set warning flags for G++/Clang++ +IF(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + SET(MY_MAINTAINER_CXX_WARNINGS "${MY_CXX_WARNING_FLAGS}") +ENDIF() + +IF(MYSQL_MAINTAINER_MODE MATCHES "ON") + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MY_MAINTAINER_C_WARNINGS}") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MY_MAINTAINER_CXX_WARNINGS}") +ELSEIF(MYSQL_MAINTAINER_MODE MATCHES "AUTO") + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${MY_MAINTAINER_C_WARNINGS}") + SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${MY_MAINTAINER_CXX_WARNINGS}") +ENDIF() diff --git a/cmake/os/Darwin.cmake b/cmake/os/Darwin.cmake index 0d8bac106f0..4ac72070e8b 100644 --- a/cmake/os/Darwin.cmake +++ b/cmake/os/Darwin.cmake @@ -1,5 +1,4 @@ -# Copyright (c) 2010 Sun Microsystems, Inc. -# Use is subject to license terms. +# Copyright (c) 2010, 2014, 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 @@ -15,21 +14,3 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # This file includes OSX specific options and quirks, related to system checks - -# Workaround for CMake bug#9051 -# (CMake does not pass CMAKE_OSX_SYSROOT and CMAKE_OSX_DEPLOYMENT_TARGET when -# running TRY_COMPILE) - -IF(CMAKE_OSX_SYSROOT) - SET(ENV{CMAKE_OSX_SYSROOT} ${CMAKE_OSX_SYSROOT}) -ENDIF() -IF(CMAKE_OSX_SYSROOT) - SET(ENV{MACOSX_DEPLOYMENT_TARGET} ${OSX_DEPLOYMENT_TARGET}) -ENDIF() - -IF(CMAKE_OSX_DEPLOYMENT_TARGET) - # Workaround linker problems on OSX 10.4 - IF(CMAKE_OSX_DEPLOYMENT_TARGET VERSION_LESS "10.5") - ADD_DEFINITIONS(-fno-common) - ENDIF() -ENDIF() diff --git a/cmake/os/WindowsCache.cmake b/cmake/os/WindowsCache.cmake index 1453cc55053..c75f2e45bf6 100644 --- a/cmake/os/WindowsCache.cmake +++ b/cmake/os/WindowsCache.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2010, 2014, 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 @@ -90,7 +90,7 @@ SET(HAVE_GETRLIMIT CACHE INTERNAL "") SET(HAVE_GETRUSAGE CACHE INTERNAL "") SET(HAVE_GETTIMEOFDAY CACHE INTERNAL "") SET(HAVE_GETWD CACHE INTERNAL "") -SET(HAVE_GMTIME_R CACHE INTERNAL "") +SET(HAVE_GMTIME_R 1 CACHE INTERNAL "") SET(HAVE_GRP_H CACHE INTERNAL "") SET(HAVE_IA64INTRIN_H CACHE INTERNAL "") SET(HAVE_IEEEFP_H CACHE INTERNAL "") @@ -111,7 +111,7 @@ SET(HAVE_LANGINFO_H CACHE INTERNAL "") SET(HAVE_LDIV 1 CACHE INTERNAL "") SET(HAVE_LIMITS_H 1 CACHE INTERNAL "") SET(HAVE_LOCALE_H 1 CACHE INTERNAL "") -SET(HAVE_LOCALTIME_R CACHE INTERNAL "") +SET(HAVE_LOCALTIME_R 1 CACHE INTERNAL "") SET(HAVE_LOG2 CACHE INTERNAL "") SET(HAVE_LONGJMP 1 CACHE INTERNAL "") SET(HAVE_LRAND48 CACHE INTERNAL "") |