Skip to content

Commit 4412f9f

Browse files
committed
Handle clang-cl warning settings the same as MSVC
1 parent ad6744a commit 4412f9f

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

cmake/BoostAddWarnings.cmake

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,14 @@ function(boost_add_warnings target level)
1414
if(NOT level IN_LIST allowed_levels)
1515
message(FATAL_ERROR "${level} is not a valid warning level (${allowed_levels})")
1616
endif()
17-
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
17+
if(MSVC)
18+
set(warn_off /W0)
19+
set(warn_on /W3)
20+
foreach(_lvl IN ITEMS all extra pedantic)
21+
set(warn_${_lvl} /W4)
22+
endforeach()
23+
set(werror /WX)
24+
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
1825
set(warn_off -w)
1926
set(warn_on -Wall)
2027
set(warn_all -Wall)
@@ -27,13 +34,6 @@ function(boost_add_warnings target level)
2734
set(warn_${_lvl} -w1)
2835
endforeach()
2936
set(werror "")
30-
elseif(MSVC)
31-
set(warn_off /W0)
32-
set(warn_on /W3)
33-
foreach(_lvl IN ITEMS all extra pedantic)
34-
set(warn_${_lvl} /W4)
35-
endforeach()
36-
set(werror /WX)
3737
endif()
3838
target_compile_options(${target} PRIVATE ${warn_${level}})
3939
if(warningsAsErrors)

0 commit comments

Comments
 (0)