diff options
author | Davi Arnaut <davi.arnaut@oracle.com> | 2010-12-15 08:30:09 -0200 |
---|---|---|
committer | Davi Arnaut <davi.arnaut@oracle.com> | 2010-12-15 08:30:09 -0200 |
commit | 650d9cc5b078dd110cad83fe9e68031c1f0c224e (patch) | |
tree | 621d527fa446381d3c794ad33ac9c9c18954234f /cmake | |
parent | 7941c7eaafdd1b69ff2752ed1fa426f0772dd104 (diff) | |
download | mariadb-git-650d9cc5b078dd110cad83fe9e68031c1f0c224e.tar.gz |
Bug#58871: Reorganize maintainer mode compiler flags to allow
option for specific compilers
Reorganize the maintainer mode cmake code to allow options
for specific compilers. For now, enable -Wcheck for ICC,
but do not turn warnings into errors.
CMakeLists.txt:
Move the code that sets options to cmake/maintainer.cmake
cmake/maintainer.cmake:
Add macros for each specific compiler.
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/maintainer.cmake | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/cmake/maintainer.cmake b/cmake/maintainer.cmake new file mode 100644 index 00000000000..468b2f40084 --- /dev/null +++ b/cmake/maintainer.cmake @@ -0,0 +1,54 @@ +# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. +# +# 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 +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +INCLUDE(CheckCCompilerFlag) + +# Setup GCC (GNU C compiler) warning options. +MACRO(SET_MYSQL_MAINTAINER_GNU_C_OPTIONS) + SET(MY_MAINTAINER_WARNINGS + "-Wall -Wextra -Wunused -Wwrite-strings -Wno-strict-aliasing -Werror") + CHECK_C_COMPILER_FLAG("-Wdeclaration-after-statement" + HAVE_DECLARATION_AFTER_STATEMENT) + IF(HAVE_DECLARATION_AFTER_STATEMENT) + SET(MY_MAINTAINER_DECLARATION_AFTER_STATEMENT + "-Wdeclaration-after-statement") + ENDIF() + SET(MY_MAINTAINER_C_WARNINGS + "${MY_MAINTAINER_WARNINGS} ${MY_MAINTAINER_DECLARATION_AFTER_STATEMENT}" + CACHE STRING "C warning options used in maintainer builds.") + # Do not make warnings in checks into errors. + SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Wno-error") +ENDMACRO() + +# Setup G++ (GNU C++ compiler) warning options. +MACRO(SET_MYSQL_MAINTAINER_GNU_CXX_OPTIONS) + SET(MY_MAINTAINER_CXX_WARNINGS + "${MY_MAINTAINER_WARNINGS} -Wno-unused-parameter" + CACHE STRING "C++ warning options used in maintainer builds.") +ENDMACRO() + +# Setup ICC (Intel C Compiler) warning options. +MACRO(SET_MYSQL_MAINTAINER_INTEL_C_OPTIONS) + SET(MY_MAINTAINER_WARNINGS "-Wcheck") + SET(MY_MAINTAINER_C_WARNINGS "${MY_MAINTAINER_WARNINGS}" + CACHE STRING "C warning options used in maintainer builds.") +ENDMACRO() + +# Setup ICPC (Intel C++ Compiler) warning options. +MACRO(SET_MYSQL_MAINTAINER_INTEL_CXX_OPTIONS) + SET(MY_MAINTAINER_CXX_WARNINGS "${MY_MAINTAINER_WARNINGS}" + CACHE STRING "C++ warning options used in maintainer builds.") +ENDMACRO() + |