Enable more warnings in cmake script

0.8
Bruno Van de Velde 2018-05-10 14:15:19 +02:00
parent 3a08eb5750
commit 856361dd42
2 changed files with 19 additions and 7 deletions

View File

@ -5,7 +5,7 @@ else()
endif()
# Use new RPATH behavior on macOS
if(NOT CMAKE_VERSION VERSION_LESS 3.9)
if(POLICY CMP0068)
cmake_policy(SET CMP0068 NEW)
endif()

View File

@ -8,12 +8,24 @@ endmacro()
# Set the compile options used by all targets
function(tgui_set_global_compile_flags target)
if(TGUI_COMPILER_GCC OR TGUI_COMPILER_CLANG)
target_compile_options(${target} PRIVATE -Wall)
target_compile_options(${target} PRIVATE -Wextra)
target_compile_options(${target} PRIVATE -Wshadow)
target_compile_options(${target} PRIVATE -Wno-long-long)
target_compile_options(${target} PRIVATE -pedantic)
if(TGUI_COMPILER_MSVC)
target_compile_options(${target} PRIVATE /W4)
else()
target_compile_options(${target}
PRIVATE
-Wall
-Wextra
-Wshadow
-Wnon-virtual-dtor
-Wold-style-cast
-Wcast-align
-Wunused
-Woverloaded-virtual
-Wpedantic
-Wlogical-op
-Wuseless-cast
-Wdouble-promotion
-Wformat=2)
set_target_properties(${target} PROPERTIES CXX_STANDARD_REQUIRED ON)
set_target_properties(${target} PROPERTIES CXX_EXTENSIONS OFF)