2014-10-13 09:52:28 +02:00
|
|
|
# Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
|
2021-04-13 16:44:09 +02:00
|
|
|
# Copyright (c) 2011, 2021, MariaDB
|
2010-12-15 11:30:09 +01:00
|
|
|
#
|
|
|
|
# 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
|
2019-05-11 20:29:06 +02:00
|
|
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA
|
2010-12-15 11:30:09 +01:00
|
|
|
|
2021-04-20 16:53:56 +02:00
|
|
|
IF(MSVC OR MYSQL_MAINTAINER_MODE STREQUAL "NO")
|
|
|
|
# Windows support is in cmake/os/Windows.cmake, not here
|
2018-02-20 22:17:36 +01:00
|
|
|
RETURN()
|
|
|
|
ENDIF()
|
|
|
|
|
2014-10-13 09:52:28 +02:00
|
|
|
# Common warning flags for GCC, G++, Clang and Clang++
|
2018-02-06 02:33:56 +01:00
|
|
|
SET(MY_WARNING_FLAGS
|
|
|
|
-Wall
|
|
|
|
-Wdeclaration-after-statement
|
2022-05-06 01:13:05 +02:00
|
|
|
-Wenum-compare
|
|
|
|
-Wenum-conversion
|
2018-02-06 02:33:56 +01:00
|
|
|
-Wextra
|
|
|
|
-Wformat-security
|
2022-10-05 17:18:30 +02:00
|
|
|
-Wmissing-braces
|
2018-02-06 02:33:56 +01:00
|
|
|
-Wno-format-truncation
|
|
|
|
-Wno-init-self
|
|
|
|
-Wno-nonnull-compare
|
|
|
|
-Wno-null-conversion
|
|
|
|
-Wno-unused-parameter
|
|
|
|
-Wno-unused-private-field
|
|
|
|
-Woverloaded-virtual
|
2018-02-08 16:06:25 +01:00
|
|
|
-Wnon-virtual-dtor
|
2018-02-06 02:33:56 +01:00
|
|
|
-Wvla
|
|
|
|
-Wwrite-strings
|
|
|
|
)
|
2014-12-19 11:35:44 +01:00
|
|
|
|
2020-04-01 14:16:11 +02:00
|
|
|
FOREACH(F ${MY_WARNING_FLAGS})
|
|
|
|
MY_CHECK_AND_SET_COMPILER_FLAG(${F} DEBUG RELWITHDEBINFO)
|
|
|
|
ENDFOREACH()
|
|
|
|
|
2021-04-20 16:53:56 +02:00
|
|
|
SET(MY_ERROR_FLAGS -Werror)
|
2020-04-01 14:16:11 +02:00
|
|
|
|
2019-03-16 19:24:49 +01:00
|
|
|
IF(CMAKE_COMPILER_IS_GNUCC AND CMAKE_C_COMPILER_VERSION VERSION_LESS "6.0.0")
|
2020-04-01 14:16:11 +02:00
|
|
|
SET(MY_ERROR_FLAGS ${MY_ERROR_FLAGS} -Wno-error=maybe-uninitialized)
|
2021-10-30 11:08:57 +02:00
|
|
|
SET(MY_ERROR_FLAGS ${MY_ERROR_FLAGS} -Wno-error=non-virtual-dtor) # gcc bug 7302
|
2019-03-16 19:24:49 +01:00
|
|
|
ENDIF()
|
|
|
|
|
2021-04-13 16:44:09 +02:00
|
|
|
IF(MYSQL_MAINTAINER_MODE MATCHES "OFF|WARN")
|
2019-03-16 19:24:49 +01:00
|
|
|
RETURN()
|
2014-12-19 11:35:44 +01:00
|
|
|
ELSEIF(MYSQL_MAINTAINER_MODE MATCHES "AUTO")
|
2018-02-06 02:33:56 +01:00
|
|
|
SET(WHERE DEBUG)
|
2014-10-13 09:52:28 +02:00
|
|
|
ENDIF()
|
2015-12-22 20:25:29 +01:00
|
|
|
|
2020-04-01 14:16:11 +02:00
|
|
|
FOREACH(F ${MY_ERROR_FLAGS})
|
2018-02-06 02:33:56 +01:00
|
|
|
MY_CHECK_AND_SET_COMPILER_FLAG(${F} ${WHERE})
|
|
|
|
ENDFOREACH()
|
|
|
|
|
2015-12-22 20:25:29 +01:00
|
|
|
IF(CMAKE_C_COMPILER_ID MATCHES "GNU")
|
|
|
|
STRING(REPLACE " -E " " -E -dDI " CMAKE_C_CREATE_PREPROCESSED_SOURCE ${CMAKE_C_CREATE_PREPROCESSED_SOURCE})
|
|
|
|
ENDIF()
|
|
|
|
IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
|
|
|
STRING(REPLACE " -E " " -E -dDI " CMAKE_CXX_CREATE_PREPROCESSED_SOURCE ${CMAKE_CXX_CREATE_PREPROCESSED_SOURCE})
|
|
|
|
ENDIF()
|