Adds ENABLE_PEDANTIC_COMPILATION CMake option.

The option is disabled by default. More flags will be added after
testing with several compilers.
This commit is contained in:
Mark de Wever 2012-07-12 18:08:17 +00:00
parent 9f25851d36
commit 1901ab0520
3 changed files with 18 additions and 0 deletions

View file

@ -96,6 +96,7 @@ if(UNIX AND NOT APPLE AND NOT CYGWIN)
endif(UNIX AND NOT APPLE AND NOT CYGWIN)
option(ENABLE_STRICT_COMPILATION "Sets the strict compilation mode" ON)
option(ENABLE_PEDANTIC_COMPILATION "Sets the pedantic compilation mode" OFF)
option(ENABLE_DEBUG_WINDOW_LAYOUT "Add the debug option to allow the generation of debug layout files in dot format" OFF)
option ( USE_ANA_NETWORK "Compile network module using ana" OFF )
option(ENABLE_DESIGN_DOCUMENTS "Enables the generation of design documents, and has additional dependencies" OFF)
@ -245,12 +246,25 @@ if(NOT CMAKE_COMPILER_IS_GNUCXX)
endif(NOT CMAKE_COMPILER_IS_GNUCXX)
### Set pedantic compiler flags.
set(CXX_FLAGS_PEDANTIC_COMPILATION)
check_compiler_has_flag(
CXX_FLAGS_PEDANTIC_COMPILATION
"-Wextra"
HAS_COMPILER_FLAG_WEXTRA
)
### Set the final compiler flags.
set(COMPILER_FLAGS "${CXX_FLAGS_PROJECT}")
if(ENABLE_STRICT_COMPILATION)
set(COMPILER_FLAGS "${COMPILER_FLAGS} ${CXX_FLAGS_STRICT_COMPILATION}")
endif(ENABLE_STRICT_COMPILATION)
if(ENABLE_PEDANTIC_COMPILATION)
set(COMPILER_FLAGS "${COMPILER_FLAGS} ${CXX_FLAGS_PEDANTIC_COMPILATION}")
endif(ENABLE_PEDANTIC_COMPILATION)
set(COMPILER_FLAGS "${COMPILER_FLAGS} ${CXX_FLAGS_USER}")
if(NOT "${CMAKE_CXX_FLAGS}" STREQUAL "${COMPILER_FLAGS}")

View file

@ -293,6 +293,9 @@ They are generated by the following parts:
will be changed to reflect the change. (Starting from Wesnoth 1.11.0 the flag
can be changed after the initial generation.) What flags are set when choosing
this option is determined by the Wesnoth developers.
- CXX_FLAGS_PEDANTIC_COMPILATION The flags used for pedantic compilation.
Whether these flags are used depends on the configuration option
ENABLE_PEDANTIC_COMPILATION.
- CXX_FLAGS_USER These flags set when configuring Wesnoth. The initial value of
this variable depends on the CXXFLAGS in the environment or defined by
-DCXX_FLAGS_USER. These flags are stored and can be changed later by running

View file

@ -350,6 +350,7 @@ Version 1.11.0-svn:
* Fixed bug #19795: OOS when [message][option] is used in a (single-player)
start event when side 1's controller is null.
* Changed: Enabled strict compilation for Clang in CMake.
* Added: ENABLE_PEDANTIC_COMPILATION option for CMake.
Version 1.10.0:
* Campaigns: