implement werror option

This commit is contained in:
itsmattkc
2022-01-12 16:35:17 -08:00
parent 88b7151c17
commit 1325f1af42
+7 -2
View File
@@ -20,6 +20,7 @@ project(olive-editor VERSION 0.2.0 LANGUAGES CXX)
option(BUILD_DOXYGEN "Build Doxygen documentation" OFF)
option(BUILD_TESTS "Build unit tests" ON)
option(USE_WERROR "Error on compile warning" ON)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
@@ -32,7 +33,6 @@ set(CMAKE_AUTORCC ON)
# Set compiler options
if(MSVC)
set(OLIVE_COMPILE_OPTIONS
/WX
/wd4267
/wd4244
/experimental:external
@@ -41,10 +41,12 @@ if(MSVC)
"$<$<CONFIG:RELEASE>:/O2>"
"$<$<COMPILE_LANGUAGE:CXX>:/MP>"
)
if (USE_WERROR)
list(APPEND OLIVE_COMPILE_OPTIONS "/WX")
endif()
else()
set(OLIVE_COMPILE_OPTIONS
"$<$<CONFIG:RELEASE>:-O2>"
-Werror
-Wuninitialized
-pedantic-errors
-Wall
@@ -52,6 +54,9 @@ else()
-Wno-unused-parameter
-Wshadow
)
if (USE_WERROR)
list(APPEND OLIVE_COMPILE_OPTIONS "-Werror")
endif()
endif()
set(OLIVE_DEFINITIONS -DQT_DEPRECATED_WARNINGS)