Skip to content

Commit 9f91964

Browse files
authored
Merge pull request #638 from kswiecicki/umf-compile-options
Remove werror compile option from UMF targets
2 parents dfe16aa + ebf618f commit 9f91964

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

cmake/helpers.cmake

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,14 +176,33 @@ function(get_program_version_major_minor name ret)
176176
PARENT_SCOPE)
177177
endfunction()
178178

179+
# Checks compiler for given ${flag}, stores the output in C_HAS_${flag} and
180+
# CXX_HAS_${flag} (if compiler supports C++)
181+
function(check_compilers_flag flag)
182+
check_c_compiler_flag("${flag}" "C_HAS_${flag}")
183+
if(CMAKE_CXX_COMPILE_FEATURES)
184+
check_cxx_compiler_flag("${flag}" "CXX_HAS_${flag}")
185+
endif()
186+
endfunction()
187+
188+
function(check_add_target_compile_options target)
189+
foreach(option ${ARGN})
190+
check_compilers_flag(${option})
191+
if(C_HAS_${option} AND CXX_HAS_${option})
192+
target_compile_options(${target} PRIVATE ${option})
193+
endif()
194+
endforeach()
195+
endfunction()
196+
179197
function(add_umf_target_compile_options name)
198+
check_add_target_compile_options(${name} "-Wno-covered-switch-default")
199+
180200
if(NOT MSVC)
181201
target_compile_options(
182202
${name}
183203
PRIVATE -fPIC
184204
-Wall
185205
-Wextra
186-
-Werror
187206
-Wpedantic
188207
-Wempty-body
189208
-Wunused-parameter

0 commit comments

Comments
 (0)