Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 16 additions & 12 deletions CMake/utility.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -390,21 +390,25 @@ endfunction()
# Adds warnings compiler options to the target depending on the category
# target Target name
####################################################################################
function( set_compiler_warnings target)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(WARNINGS "-Werror"
"-Wall")
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(WARNINGS "-Werror"
"-Wall")
elseif(MSVC)
set(WARNINGS "/WX"
"/W4")
endif()

target_compile_options(${target} PRIVATE ${WARNINGS})
function(set_compiler_warnings target)
# Return if WARNINGS_AS_ERROR is OFF
if(NOT WARNINGS_AS_ERROR)
return()
endif()

if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(WARNINGS "-Werror" "-Wall")
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(WARNINGS "-Werror" "-Wall")
elseif(MSVC)
set(WARNINGS "/WX" "/W4")
endif()

target_compile_options(${target} PRIVATE ${WARNINGS})
endfunction()


####################################################################################
# Adds or replace a compiler option
# _OLD_OPTION The option which should be replaced
Expand Down
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
# the build configuration options are initialized. #
####################################################################################

cmake_minimum_required (VERSION 3.0)
cmake_minimum_required (VERSION 3.5)

project ("rttr" LANGUAGES CXX)

Expand Down Expand Up @@ -60,6 +60,7 @@ option(BUILD_PACKAGE "Enable this to build the installer" ON)
option(USE_PCH "Use precompiled header files for compilation" ON)
option(CUSTOM_DOXYGEN_STYLE "Enable this option to use a custom doxygen style for HTML documentation; Otherwise the default will be used" ON)
option(BUILD_WEBSITE_DOCU "Enable this option to create the special docu for the website" OFF)
option(WARNINGS_AS_ERROR "Enable this option to treat warnings as error" OFF)

# one precompiled headers cannot be used for multiple ninja targets
# thats why we have to disable this option, when BUILD_STATIC or
Expand Down