Skip to content
Snippets Groups Projects
Verified Commit 047ea3f9 authored by Martin Stump's avatar Martin Stump
Browse files

Add compiler warnings


* Based on cppbestpractices

Signed-off-by: default avatarMartin Stump <martin.stump@mercedes-benz.com>
parent 322d1bf2
Branches main
Tags v0.2.1
No related merge requests found
......@@ -24,8 +24,10 @@ project(
HOMEPAGE_URL https://gitlab.eclipse.org/eclipse/simopenpass/yase
LANGUAGES CXX)
option(Yase_BUILD_TESTS "Build the tests" ${Yase_IS_TOP_LEVEL})
option(Yase_BUILD_DOCS "Build the documentation" ${Yase_IS_TOP_LEVEL})
option(Yase_BUILD_TESTS "Build the tests" ${Yase_IS_TOP_LEVEL})
option(Yase_ENABLE_WARNINGS "Enable compiler warnings" ${Yase_IS_TOP_LEVEL})
option(Yase_ENABLE_WERROR "Fail on compiler warnings" ${Yase_IS_TOP_LEVEL})
option(Yase_INSTALL "Enable installation" ${Yase_IS_TOP_LEVEL})
include(CMakeDependentOption)
......@@ -52,6 +54,62 @@ if(Yase_BUILD_TESTS)
enable_testing()
endif()
if(MSVC)
if(Yase_ENABLE_WARNINGS)
add_compile_options(
/permissive-
/w14242
/w14254
/w14263
/w14265
/w14287
/w14296
/w14311
/w14545
/w14546
/w14547
/w14549
/w14555
/w14619
/w14640
/w14640
/w14826
/w14905
/w14906
/w14928
/W4
/we4289)
endif()
if(Yase_ENABLE_WERROR)
add_compile_options(/WX)
endif()
else()
if(Yase_ENABLE_WARNINGS)
add_compile_options(
-pedantic
-Wall
-Wcast-align
-Wconversion
-Wdouble-promotion
-Wduplicated-branches
-Wduplicated-cond
-Wextra
-Wformat=2
-Wimplicit-fallthrough
-Wmisleading-indentation
-Wnon-virtual-dtor
-Wnull-dereference
-Wold-style-cast
-Woverloaded-virtual
-Wshadow
-Wsign-conversion
-Wunused)
endif()
if(Yase_ENABLE_WERROR)
add_compile_options(-Werror)
endif()
endif()
add_subdirectory(middle_end)
export(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment