From 699bfa804ec273e8fcf7b82c256778ad0a28e9a4 Mon Sep 17 00:00:00 2001 From: Alfi Maulana Date: Sat, 14 Jan 2023 18:07:51 +0700 Subject: [PATCH] guard CMake warning if `CHECK_SURPASS_WARNING` is set --- test/CMakeLists.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index f240946..434f472 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -4,8 +4,10 @@ project(test) option(CHECK_USING_CLANG "check if target is compiled using Clang" OFF) option(CHECK_SURPASS_WARNING "check if target could surpass a compiler warning" OFF) -set(CMAKE_C_FLAGS "-Werror -Wunused-variable ${CMAKE_C_FLAGS}") -set(CMAKE_CXX_FLAGS "-Werror -Wunused-variable ${CMAKE_CXX_FLAGS}") +if(CHECK_SURPASS_WARNING) + set(CMAKE_C_FLAGS "-Werror -Wunused-variable ${CMAKE_C_FLAGS}") + set(CMAKE_CXX_FLAGS "-Werror -Wunused-variable ${CMAKE_CXX_FLAGS}") +endif() add_executable(hello_world hello_world.cpp)