diff options
author | Davi Arnaut <Davi.Arnaut@Sun.COM> | 2010-07-12 13:39:00 -0300 |
---|---|---|
committer | Davi Arnaut <Davi.Arnaut@Sun.COM> | 2010-07-12 13:39:00 -0300 |
commit | 47a4a881603e54482da8ead11503ed02cb0aef57 (patch) | |
tree | ffa5f89c85ba8f8e0b27c4c4531ecef1ae833fac | |
parent | 7df08645980c56b343dc32e3c543fbcb0c8f7259 (diff) | |
download | mariadb-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.
-rw-r--r-- | CMakeLists.txt | 34 | ||||
-rw-r--r-- | cmake/configure.pl | 6 | ||||
-rw-r--r-- | storage/innobase/CMakeLists.txt | 2 |
3 files changed, 41 insertions, 1 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. diff --git a/cmake/configure.pl b/cmake/configure.pl index fba417365fc..5be47ce5a31 100644 --- a/cmake/configure.pl +++ b/cmake/configure.pl @@ -184,6 +184,12 @@ foreach my $option (@ARGV) $cmakeargs = $cmakeargs." -DWITH_DEBUG_FULL=1"; next; } + if ($option =~ /mysql-maintainer-mode/) + { + $cmakeargs = $cmakeargs." -DMYSQL_MAINTAINER_MODE=" . + ($option =~ /enable/ ? "1" : "0"); + next; + } $option = uc($option); $option =~ s/-/_/g; diff --git a/storage/innobase/CMakeLists.txt b/storage/innobase/CMakeLists.txt index 90246aaa99d..b6399dcc478 100644 --- a/storage/innobase/CMakeLists.txt +++ b/storage/innobase/CMakeLists.txt @@ -95,7 +95,7 @@ IF(NOT CMAKE_CROSSCOMPILING) #include <pthread.h> #include <string.h> - int main(int argc, char** argv) { + int main() { pthread_t x1; pthread_t x2; pthread_t x3; |