From 1325f1af4228948e70b19503a72fff49b8888f99 Mon Sep 17 00:00:00 2001 From: itsmattkc <34096995+itsmattkc@users.noreply.github.com> Date: Wed, 12 Jan 2022 16:35:17 -0800 Subject: [PATCH] implement werror option --- CMakeLists.txt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 27d98682d..8c9f307ad 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) "$<$:/O2>" "$<$:/MP>" ) + if (USE_WERROR) + list(APPEND OLIVE_COMPILE_OPTIONS "/WX") + endif() else() set(OLIVE_COMPILE_OPTIONS "$<$:-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)