mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 02:05:57 +01:00
Bug#17633291: SET PROPER COMPILE OPTIONS FOR CLANG
Bug#17959689: MAKE GCC AND CLANG GIVE CONSISTENT COMPILATION WARNINGS Bug#18313717: ENABLE -WERROR IN MAINTANER MODE WHEN COMPILING WITH CLANG Bug#18510941: REMOVE CMAKE WORKAROUNDS FOR OLDER VERSIONS OF OS X/XCODE Backport from mysql-5.6 to mysql-5.5
This commit is contained in:
parent
0827d75627
commit
57eec7bc29
13 changed files with 187 additions and 117 deletions
|
@ -27,10 +27,12 @@ ENDIF()
|
|||
|
||||
# We use the LOCATION target property (CMP0026)
|
||||
# and get_target_property() for non-existent targets (CMP0045)
|
||||
# and INSTALL_NAME_DIR (CMP0042)
|
||||
IF(CMAKE_VERSION VERSION_EQUAL "3.0.0" OR
|
||||
CMAKE_VERSION VERSION_GREATER "3.0.0")
|
||||
CMAKE_POLICY(SET CMP0026 OLD)
|
||||
CMAKE_POLICY(SET CMP0045 OLD)
|
||||
CMAKE_POLICY(SET CMP0042 OLD)
|
||||
ENDIF()
|
||||
|
||||
MESSAGE(STATUS "Running cmake version ${CMAKE_VERSION}")
|
||||
|
@ -73,11 +75,9 @@ ENDIF()
|
|||
SET(BUILDTYPE_DOCSTRING
|
||||
"Choose the type of build, options are: None(CMAKE_CXX_FLAGS or
|
||||
CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel")
|
||||
|
||||
|
||||
IF(WITH_DEBUG)
|
||||
SET(CMAKE_BUILD_TYPE "Debug" CACHE STRING ${BUILDTYPE_DOCSTRING} FORCE)
|
||||
SET(MYSQL_MAINTAINER_MODE ON CACHE BOOL
|
||||
"MySQL maintainer-specific development environment")
|
||||
IF(UNIX AND NOT APPLE)
|
||||
# Compiling with PIC speeds up embedded build, on PIC sensitive systems
|
||||
# Predefine it to ON, in case user chooses to build embedded.
|
||||
|
@ -107,6 +107,15 @@ ELSE()
|
|||
ENDIF()
|
||||
PROJECT(${MYSQL_PROJECT_NAME})
|
||||
|
||||
# Maintainer mode is default on only for Linux debug builds using GCC/G++
|
||||
IF(CMAKE_BUILD_TYPE MATCHES "Debug" OR WITH_DEBUG)
|
||||
IF(CMAKE_SYSTEM_NAME MATCHES "Linux" AND
|
||||
CMAKE_COMPILER_IS_GNUCC AND CMAKE_COMPILER_IS_GNUCXX)
|
||||
SET(MYSQL_MAINTAINER_MODE ON CACHE BOOL
|
||||
"MySQL maintainer-specific development environment")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(BUILD_CONFIG)
|
||||
INCLUDE(
|
||||
${CMAKE_SOURCE_DIR}/cmake/build_configurations/${BUILD_CONFIG}.cmake)
|
||||
|
@ -130,38 +139,12 @@ FOREACH(_base
|
|||
ENDFOREACH()
|
||||
|
||||
|
||||
|
||||
# Following autotools tradition, add preprocessor definitions
|
||||
# specified in environment variable CPPFLAGS
|
||||
IF(DEFINED ENV{CPPFLAGS})
|
||||
ADD_DEFINITIONS($ENV{CPPFLAGS})
|
||||
ENDIF()
|
||||
|
||||
#
|
||||
# Control aspects of the development environment which are
|
||||
# specific to MySQL maintainers and developers.
|
||||
#
|
||||
INCLUDE(maintainer)
|
||||
|
||||
OPTION(MYSQL_MAINTAINER_MODE
|
||||
"MySQL maintainer-specific development environment" OFF)
|
||||
|
||||
# Whether the maintainer mode compiler options should be enabled.
|
||||
IF(MYSQL_MAINTAINER_MODE)
|
||||
IF(CMAKE_C_COMPILER_ID MATCHES "GNU")
|
||||
SET_MYSQL_MAINTAINER_GNU_C_OPTIONS()
|
||||
ENDIF()
|
||||
IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
||||
SET_MYSQL_MAINTAINER_GNU_CXX_OPTIONS()
|
||||
ENDIF()
|
||||
IF(CMAKE_C_COMPILER_ID MATCHES "Intel")
|
||||
SET_MYSQL_MAINTAINER_INTEL_C_OPTIONS()
|
||||
ENDIF()
|
||||
IF(CMAKE_CXX_COMPILER_ID MATCHES "Intel")
|
||||
SET_MYSQL_MAINTAINER_INTEL_CXX_OPTIONS()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
# Add macros
|
||||
INCLUDE(character_sets)
|
||||
INCLUDE(zlib)
|
||||
|
@ -192,7 +175,6 @@ OPTION (WITH_UNIT_TESTS "Compile MySQL with unit tests" ON)
|
|||
MARK_AS_ADVANCED(CYBOZU BACKUP_TEST WITHOUT_SERVER DISABLE_SHARED)
|
||||
|
||||
|
||||
|
||||
include(CheckCSourceCompiles)
|
||||
include(CheckCXXSourceCompiles)
|
||||
# We need some extra FAIL_REGEX patterns
|
||||
|
@ -373,13 +355,13 @@ MYSQL_CHECK_READLINE()
|
|||
# not run with the warning options as to not perturb fragile checks
|
||||
# (i.e. do not make warnings into errors).
|
||||
#
|
||||
IF(MYSQL_MAINTAINER_MODE)
|
||||
# Set compiler flags required under maintainer mode.
|
||||
MESSAGE(STATUS "C warning options: ${MY_MAINTAINER_C_WARNINGS}")
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MY_MAINTAINER_C_WARNINGS}")
|
||||
MESSAGE(STATUS "C++ warning options: ${MY_MAINTAINER_CXX_WARNINGS}")
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MY_MAINTAINER_CXX_WARNINGS}")
|
||||
ENDIF()
|
||||
# Why doesn't these flags affect the entire build?
|
||||
# Because things may already have been included with ADD_SUBDIRECTORY
|
||||
#
|
||||
OPTION(MYSQL_MAINTAINER_MODE
|
||||
"MySQL maintainer-specific development environment" OFF)
|
||||
|
||||
INCLUDE(maintainer)
|
||||
|
||||
IF(NOT WITHOUT_SERVER)
|
||||
SET (MYSQLD_STATIC_PLUGIN_LIBS "" CACHE INTERNAL "")
|
||||
|
@ -395,7 +377,6 @@ ADD_SUBDIRECTORY(regex)
|
|||
ADD_SUBDIRECTORY(mysys)
|
||||
ADD_SUBDIRECTORY(libmysql)
|
||||
|
||||
|
||||
IF(WITH_UNIT_TESTS)
|
||||
ENABLE_TESTING()
|
||||
ENDIF()
|
||||
|
@ -487,7 +468,6 @@ IF(NOT INSTALL_LAYOUT MATCHES "RPM")
|
|||
)
|
||||
INSTALL(FILES README DESTINATION ${INSTALL_DOCREADMEDIR} COMPONENT Readme)
|
||||
INSTALL(FILES ${CMAKE_BINARY_DIR}/Docs/INFO_SRC ${CMAKE_BINARY_DIR}/Docs/INFO_BIN DESTINATION ${INSTALL_DOCDIR})
|
||||
|
||||
IF(UNIX)
|
||||
INSTALL(FILES Docs/INSTALL-BINARY DESTINATION ${INSTALL_DOCREADMEDIR} COMPONENT Readme)
|
||||
ENDIF()
|
||||
|
@ -507,3 +487,37 @@ IF(NOT INSTALL_LAYOUT MATCHES "RPM")
|
|||
ENDIF()
|
||||
|
||||
INCLUDE(CPack)
|
||||
|
||||
# C compiler flags consist of:
|
||||
# CPPFLAGS Taken from environment, see above.
|
||||
# ADD_DEFINITIONS In each individual CMakeLists.txt
|
||||
# CMAKE_C_FLAGS From command line.
|
||||
# We extend these in maintainer.cmake
|
||||
# ENV{CFLAGS} From environment, but environment is ignored if
|
||||
# CMAKE_C_FLAGS is also given on command line
|
||||
# CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE}
|
||||
# We extend these in compiler_options.cmake
|
||||
#
|
||||
# Note that CMakeCache.txt contains cmake builtins for these variables,
|
||||
# *not* the values that will actually be used:
|
||||
|
||||
IF(CMAKE_GENERATOR MATCHES "Makefiles")
|
||||
MESSAGE(STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
|
||||
ENDIF()
|
||||
GET_PROPERTY(cwd_definitions DIRECTORY PROPERTY COMPILE_DEFINITIONS)
|
||||
MESSAGE(STATUS "COMPILE_DEFINITIONS: ${cwd_definitions}")
|
||||
MESSAGE(STATUS "CMAKE_C_FLAGS: ${CMAKE_C_FLAGS}")
|
||||
MESSAGE(STATUS "CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}")
|
||||
IF(CMAKE_BUILD_TYPE AND CMAKE_GENERATOR MATCHES "Makefiles")
|
||||
STRING(TOUPPER "${CMAKE_BUILD_TYPE}" CMAKEBT)
|
||||
MESSAGE(STATUS "CMAKE_C_FLAGS_${CMAKEBT}: ${CMAKE_C_FLAGS_${CMAKEBT}}")
|
||||
MESSAGE(STATUS "CMAKE_CXX_FLAGS_${CMAKEBT}: ${CMAKE_CXX_FLAGS_${CMAKEBT}}")
|
||||
ENDIF()
|
||||
IF(NOT CMAKE_GENERATOR MATCHES "Makefiles")
|
||||
MESSAGE(STATUS "CMAKE_C_FLAGS_DEBUG: ${CMAKE_C_FLAGS_DEBUG}")
|
||||
MESSAGE(STATUS "CMAKE_CXX_FLAGS_DEBUG: ${CMAKE_CXX_FLAGS_DEBUG}")
|
||||
MESSAGE(STATUS
|
||||
"CMAKE_C_FLAGS_RELWITHDEBINFO: ${CMAKE_C_FLAGS_RELWITHDEBINFO}")
|
||||
MESSAGE(STATUS
|
||||
"CMAKE_CXX_FLAGS_RELWITHDEBINFO: ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
|
||||
ENDIF()
|
||||
|
|
|
@ -35,6 +35,12 @@ ENDIF(UNIX)
|
|||
|
||||
MYSQL_ADD_EXECUTABLE(mysqltest mysqltest.cc COMPONENT Test)
|
||||
SET_SOURCE_FILES_PROPERTIES(mysqltest.cc PROPERTIES COMPILE_FLAGS "-DTHREADS")
|
||||
# mysqltest has unused result errors, so we skip Werror
|
||||
CHECK_C_COMPILER_FLAG("-Werror" HAVE_WERROR_FLAG)
|
||||
IF(HAVE_WERROR_FLAG)
|
||||
INCLUDE(${MYSQL_CMAKE_SCRIPT_DIR}/compile_flags.cmake)
|
||||
ADD_COMPILE_FLAGS(mysqltest.cc COMPILE_FLAGS "-Wno-error")
|
||||
ENDIF()
|
||||
TARGET_LINK_LIBRARIES(mysqltest mysqlclient regex)
|
||||
|
||||
|
||||
|
|
|
@ -189,15 +189,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
|
||||
|
|
44
cmake/compile_flags.cmake
Normal file
44
cmake/compile_flags.cmake
Normal file
|
@ -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()
|
|
@ -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,42 +13,39 @@
|
|||
# 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)
|
||||
# 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()
|
||||
|
||||
# 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()
|
||||
# Common warning flags for GCC and Clang
|
||||
SET(MY_C_WARNING_FLAGS
|
||||
"${MY_WARNING_FLAGS} -Wwrite-strings -Wdeclaration-after-statement")
|
||||
|
||||
# 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 -Woverloaded-virtual"
|
||||
CACHE STRING "C++ warning options used in maintainer builds.")
|
||||
ENDMACRO()
|
||||
# Common warning flags for G++ and Clang++
|
||||
SET(MY_CXX_WARNING_FLAGS
|
||||
"${MY_WARNING_FLAGS} -Woverloaded-virtual -Wno-unused-parameter")
|
||||
|
||||
# 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()
|
||||
# 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()
|
||||
|
||||
# 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()
|
||||
# Turn on Werror (warning => error) when using maintainer mode.
|
||||
IF(MYSQL_MAINTAINER_MODE)
|
||||
SET(MY_C_WARNING_FLAGS "${MY_C_WARNING_FLAGS} -Werror")
|
||||
SET(MY_CXX_WARNING_FLAGS "${MY_CXX_WARNING_FLAGS} -Werror")
|
||||
SET(COMPILE_FLAG_WERROR 1)
|
||||
ENDIF()
|
||||
|
||||
# Set warning flags for GCC/Clang
|
||||
IF(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MY_C_WARNING_FLAGS}")
|
||||
ENDIF()
|
||||
# Set warning flags for G++/Clang++
|
||||
IF(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MY_CXX_WARNING_FLAGS}")
|
||||
ENDIF()
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -53,15 +53,6 @@ IF(NOT SYSTEM_TYPE)
|
|||
ENDIF()
|
||||
|
||||
|
||||
# Always enable -Wall for gnu C/C++
|
||||
IF(CMAKE_COMPILER_IS_GNUCXX)
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-unused-parameter")
|
||||
ENDIF()
|
||||
IF(CMAKE_COMPILER_IS_GNUCC)
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
|
||||
ENDIF()
|
||||
|
||||
|
||||
IF(CMAKE_COMPILER_IS_GNUCXX)
|
||||
# MySQL "canonical" GCC flags. At least -fno-rtti flag affects
|
||||
# ABI and cannot be simply removed.
|
||||
|
|
|
@ -93,6 +93,14 @@ SET(SQL_EMBEDDED_SOURCES emb_qcache.cc libmysqld.c lib_sql.cc
|
|||
)
|
||||
|
||||
|
||||
# These files have unused result errors, so we skip Werror
|
||||
CHECK_C_COMPILER_FLAG("-Werror" HAVE_WERROR_FLAG)
|
||||
IF(HAVE_WERROR_FLAG)
|
||||
INCLUDE(${MYSQL_CMAKE_SCRIPT_DIR}/compile_flags.cmake)
|
||||
ADD_COMPILE_FLAGS(../sql/filesort.cc COMPILE_FLAGS "-Wno-error")
|
||||
ADD_COMPILE_FLAGS(../sql/opt_range.cc COMPILE_FLAGS "-Wno-error")
|
||||
ENDIF()
|
||||
|
||||
ADD_CONVENIENCE_LIBRARY(sql_embedded ${SQL_EMBEDDED_SOURCES})
|
||||
DTRACE_INSTRUMENT(sql_embedded)
|
||||
ADD_DEPENDENCIES(sql_embedded GenError GenServerSource)
|
||||
|
|
|
@ -33,6 +33,12 @@ IF(UNIX)
|
|||
ENDIF(UNIX)
|
||||
|
||||
MYSQL_ADD_EXECUTABLE(mysqltest_embedded ../../client/mysqltest.cc)
|
||||
# mysqltest has unused result errors, so we skip Werror
|
||||
CHECK_C_COMPILER_FLAG("-Werror" HAVE_WERROR_FLAG)
|
||||
IF(HAVE_WERROR_FLAG)
|
||||
INCLUDE(${MYSQL_CMAKE_SCRIPT_DIR}/compile_flags.cmake)
|
||||
ADD_COMPILE_FLAGS(../../client/mysqltest.cc COMPILE_FLAGS "-Wno-error")
|
||||
ENDIF()
|
||||
TARGET_LINK_LIBRARIES(mysqltest_embedded mysqlserver)
|
||||
|
||||
|
||||
|
|
|
@ -28,7 +28,9 @@ MYSQL_ADD_PLUGIN(qa_auth_client qa_auth_client.c
|
|||
MODULE_ONLY)
|
||||
|
||||
CHECK_CXX_SOURCE_COMPILES(
|
||||
"#define _GNU_SOURCE
|
||||
"#ifndef _GNU_SOURCE
|
||||
#define _GNU_SOURCE
|
||||
#endif
|
||||
#include <sys/socket.h>
|
||||
int main() {
|
||||
struct ucred cred;
|
||||
|
|
|
@ -88,16 +88,20 @@ ENDIF()
|
|||
|
||||
IF(CMAKE_GENERATOR MATCHES "Makefiles")
|
||||
# Strip maintainer mode options if necessary
|
||||
STRING(REPLACE "${MY_MAINTAINER_C_WARNINGS}" "" CFLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_RELWITHDEBINFO}")
|
||||
STRING(REPLACE "${MY_MAINTAINER_CXX_WARNINGS}" "" CXXFLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
|
||||
STRING(REPLACE "${MY_C_WARNING_FLAGS}" "" CFLAGS
|
||||
"${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_RELWITHDEBINFO}")
|
||||
STRING(REPLACE "${MY_CXX_WARNING_FLAGS}" "" CXXFLAGS
|
||||
"${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
|
||||
FOREACH(ARCH ${CMAKE_OSX_ARCHITECTURES})
|
||||
SET(CFLAGS "${CFLAGS} -arch ${ARCH}")
|
||||
SET(CXXFLAGS "${CXXFLAGS} -arch ${ARCH}")
|
||||
ENDFOREACH()
|
||||
ELSE()
|
||||
# Strip maintainer mode options if necessary
|
||||
STRING(REPLACE "${MY_MAINTAINER_C_WARNINGS}" "" CFLAGS "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
|
||||
STRING(REPLACE "${MY_MAINTAINER_CXX_WARNINGS}" "" CXXFLAGS "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
|
||||
STRING(REPLACE "${MY_C_WARNING_FLAGS}" "" CFLAGS
|
||||
"${CMAKE_C_FLAGS_RELWITHDEBINFO}")
|
||||
STRING(REPLACE "${MY_CXX_WARNING_FLAGS}" "" CXXFLAGS
|
||||
"${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
|
||||
ENDIF()
|
||||
|
||||
IF(UNIX)
|
||||
|
|
|
@ -80,6 +80,14 @@ SET (SQL_SOURCE
|
|||
${GEN_SOURCES}
|
||||
${MYSYS_LIBWRAP_SOURCE})
|
||||
|
||||
# These files have unused result errors, so we skip Werror
|
||||
CHECK_C_COMPILER_FLAG("-Werror" HAVE_WERROR_FLAG)
|
||||
IF(HAVE_WERROR_FLAG)
|
||||
INCLUDE(${MYSQL_CMAKE_SCRIPT_DIR}/compile_flags.cmake)
|
||||
ADD_COMPILE_FLAGS(filesort.cc COMPILE_FLAGS "-Wno-error")
|
||||
ADD_COMPILE_FLAGS(opt_range.cc COMPILE_FLAGS "-Wno-error")
|
||||
ENDIF()
|
||||
|
||||
MYSQL_ADD_PLUGIN(partition ha_partition.cc STORAGE_ENGINE DEFAULT STATIC_ONLY
|
||||
RECOMPILE_FOR_EMBEDDED)
|
||||
|
||||
|
|
|
@ -247,6 +247,14 @@ SET(INNOBASE_SOURCES btr/btr0btr.c btr/btr0cur.c btr/btr0pcur.c btr/btr0sea.c
|
|||
ut/ut0byte.c ut/ut0dbg.c ut/ut0list.c ut/ut0mem.c ut/ut0rbt.c ut/ut0rnd.c
|
||||
ut/ut0ut.c ut/ut0vec.c ut/ut0wqueue.c ut/ut0bh.c)
|
||||
|
||||
# These files have unused result errors, so we skip Werror
|
||||
CHECK_C_COMPILER_FLAG("-Werror" HAVE_WERROR)
|
||||
IF(HAVE_WERROR)
|
||||
INCLUDE(${MYSQL_CMAKE_SCRIPT_DIR}/compile_flags.cmake)
|
||||
ADD_COMPILE_FLAGS(page/page0zip.c COMPILE_FLAGS "-Wno-error")
|
||||
ADD_COMPILE_FLAGS(ut/ut0ut.c COMPILE_FLAGS "-Wno-error")
|
||||
ENDIF()
|
||||
|
||||
IF(WITH_INNODB)
|
||||
# Legacy option
|
||||
SET(WITH_INNOBASE_STORAGE_ENGINE TRUE)
|
||||
|
|
Loading…
Add table
Reference in a new issue