summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-04-01 15:16:11 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2020-04-01 15:16:11 +0300
commit31eaa2029f3c2a4f8e5609ce8b87682286238d9a (patch)
tree3fc18d79ea552dca3b1a6682c2abd00568e48569
parentf813131c7b235a490399764ba75c6138e602c23e (diff)
downloadmariadb-git-31eaa2029f3c2a4f8e5609ce8b87682286238d9a.tar.gz
MDEV-19740: Have MYSQL_MAINTAINER_MODE only enable -Werror
Let us enable all GCC and clang warnings independently of the MYSQL_MAINTAINER_MODE setting for both Debug and RelWithDebInfo builds, and have MYSQL_MAINTAINER_MODE only enable -Werror. The default setting of MYSQL_MAINTAINER_MODE=AUTO will continue to apply the -Werror only to CMAKE_BUILD_TYPE=Debug. To build a debug version without -Werror, MYSQL_MAINTAINER_MODE=OFF can be used.
-rw-r--r--cmake/maintainer.cmake12
1 files changed, 9 insertions, 3 deletions
diff --git a/cmake/maintainer.cmake b/cmake/maintainer.cmake
index 8c2deeb8e40..9c51cb797bb 100644
--- a/cmake/maintainer.cmake
+++ b/cmake/maintainer.cmake
@@ -1,4 +1,5 @@
# Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2020, MariaDB
#
# 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
@@ -28,11 +29,16 @@ SET(MY_WARNING_FLAGS
-Woverloaded-virtual
-Wvla
-Wwrite-strings
- -Werror
)
+FOREACH(F ${MY_WARNING_FLAGS})
+ MY_CHECK_AND_SET_COMPILER_FLAG(${F} DEBUG RELWITHDEBINFO)
+ENDFOREACH()
+
+SET(MY_ERROR_FLAGS -Werror)
+
IF(CMAKE_COMPILER_IS_GNUCC AND CMAKE_C_COMPILER_VERSION VERSION_LESS "6.0.0")
- SET(MY_WARNING_FLAGS ${MY_WARNING_FLAGS} -Wno-error=maybe-uninitialized)
+ SET(MY_ERROR_FLAGS ${MY_ERROR_FLAGS} -Wno-error=maybe-uninitialized)
ENDIF()
IF(MYSQL_MAINTAINER_MODE MATCHES "OFF")
@@ -41,7 +47,7 @@ ELSEIF(MYSQL_MAINTAINER_MODE MATCHES "AUTO")
SET(WHERE DEBUG)
ENDIF()
-FOREACH(F ${MY_WARNING_FLAGS})
+FOREACH(F ${MY_ERROR_FLAGS})
MY_CHECK_AND_SET_COMPILER_FLAG(${F} ${WHERE})
ENDFOREACH()