Commit 47a4a881 authored by Davi Arnaut's avatar Davi Arnaut

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.
parent 7df08645
...@@ -104,6 +104,27 @@ IF(DEFINED ENV{CPPFLAGS}) ...@@ -104,6 +104,27 @@ IF(DEFINED ENV{CPPFLAGS})
ADD_DEFINITIONS($ENV{CPPFLAGS}) ADD_DEFINITIONS($ENV{CPPFLAGS})
ENDIF() 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 # Add macros
INCLUDE(character_sets) INCLUDE(character_sets)
INCLUDE(zlib) INCLUDE(zlib)
...@@ -227,6 +248,19 @@ MYSQL_CHECK_SSL() ...@@ -227,6 +248,19 @@ MYSQL_CHECK_SSL()
# Add readline or libedit. # Add readline or libedit.
MYSQL_CHECK_READLINE() 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) IF(NOT WITHOUT_SERVER)
SET (MYSQLD_STATIC_PLUGIN_LIBS "" CACHE INTERNAL "") SET (MYSQLD_STATIC_PLUGIN_LIBS "" CACHE INTERNAL "")
# Add storage engines and plugins. # Add storage engines and plugins.
......
...@@ -184,6 +184,12 @@ foreach my $option (@ARGV) ...@@ -184,6 +184,12 @@ foreach my $option (@ARGV)
$cmakeargs = $cmakeargs." -DWITH_DEBUG_FULL=1"; $cmakeargs = $cmakeargs." -DWITH_DEBUG_FULL=1";
next; next;
} }
if ($option =~ /mysql-maintainer-mode/)
{
$cmakeargs = $cmakeargs." -DMYSQL_MAINTAINER_MODE=" .
($option =~ /enable/ ? "1" : "0");
next;
}
$option = uc($option); $option = uc($option);
$option =~ s/-/_/g; $option =~ s/-/_/g;
......
...@@ -95,7 +95,7 @@ IF(NOT CMAKE_CROSSCOMPILING) ...@@ -95,7 +95,7 @@ IF(NOT CMAKE_CROSSCOMPILING)
#include <pthread.h> #include <pthread.h>
#include <string.h> #include <string.h>
int main(int argc, char** argv) { int main() {
pthread_t x1; pthread_t x1;
pthread_t x2; pthread_t x2;
pthread_t x3; pthread_t x3;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment