summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorDavi Arnaut <Davi.Arnaut@Sun.COM>2010-07-12 13:39:00 -0300
committerDavi Arnaut <Davi.Arnaut@Sun.COM>2010-07-12 13:39:00 -0300
commit47a4a881603e54482da8ead11503ed02cb0aef57 (patch)
treeffa5f89c85ba8f8e0b27c4c4531ecef1ae833fac /CMakeLists.txt
parent7df08645980c56b343dc32e3c543fbcb0c8f7259 (diff)
downloadmariadb-git-47a4a881603e54482da8ead11503ed02cb0aef57.tar.gz
Add the cmake option MYSQL_MAINTAINER_MODE which is equivalent
to the autotools option mysql-maintainer-mode. This option is intended to set a few flags that should be activated by anyone doing MySQL development, regardless of the build type. Also, the flags are only set by the very end of the platform checks as to not disturb fragile checks.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt34
1 files changed, 34 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0131ac1b0a7..bc9adafcf63 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -104,6 +104,27 @@ IF(DEFINED ENV{CPPFLAGS})
ADD_DEFINITIONS($ENV{CPPFLAGS})
ENDIF()
+#
+# Control aspects of the development environment which are
+# specific to MySQL maintainers and developers.
+#
+OPTION(MYSQL_MAINTAINER_MODE "MySQL maintainer-specific development environment" OFF)
+# Whether the maintainer mode should be enabled.
+IF(MYSQL_MAINTAINER_MODE)
+ IF(CMAKE_COMPILER_IS_GNUCC)
+ SET(MY_MAINTAINER_C_WARNINGS "-Wall -Wextra -Wunused -Wwrite-strings -Werror"
+ CACHE STRING "C warning options used in maintainer builds.")
+ ENDIF()
+ IF(CMAKE_COMPILER_IS_GNUCXX)
+ SET(MY_MAINTAINER_CXX_WARNINGS "${MY_MAINTAINER_C_WARNINGS} -Wno-unused-parameter"
+ CACHE STRING "C++ warning options used in maintainer builds.")
+ ENDIF()
+ # Do not make warnings in checks into errors.
+ IF(CMAKE_COMPILER_IS_GNUCC AND CMAKE_COMPILER_IS_GNUCXX)
+ SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Wno-error")
+ ENDIF()
+ENDIF()
+
# Add macros
INCLUDE(character_sets)
INCLUDE(zlib)
@@ -227,6 +248,19 @@ MYSQL_CHECK_SSL()
# Add readline or libedit.
MYSQL_CHECK_READLINE()
+#
+# Setup maintainer mode options by the end. Platform checks are
+# 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()
+
IF(NOT WITHOUT_SERVER)
SET (MYSQLD_STATIC_PLUGIN_LIBS "" CACHE INTERNAL "")
# Add storage engines and plugins.