Skip to content

Commit 934bf7b

Browse files
authored
[build] CMake: Make NO_WERROR also work on MSVC (wpilibsuite#7594)
1 parent fe49cbe commit 934bf7b

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

cmake/modules/CompileWarnings.cmake

+13-11
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,20 @@ macro(wpilib_target_warnings target)
1414

1515
target_compile_options(${target} PRIVATE ${WARNING_FLAGS})
1616
else()
17-
target_compile_options(
18-
${target}
19-
PRIVATE
20-
/wd4146
21-
/wd4244
22-
/wd4251
23-
/wd4267
24-
/wd4324
25-
/WX
26-
/D_CRT_SECURE_NO_WARNINGS
27-
${WPILIB_TARGET_WARNINGS}
17+
set(WARNING_FLAGS
18+
/wd4146
19+
/wd4244
20+
/wd4251
21+
/wd4267
22+
/wd4324
23+
/D_CRT_SECURE_NO_WARNINGS
24+
${WPILIB_TARGET_WARNINGS}
2825
)
26+
if(NOT NO_WERROR)
27+
set(WARNING_FLAGS ${WARNING_FLAGS} /WX)
28+
endif()
29+
30+
target_compile_options(${target} PRIVATE ${WARNING_FLAGS})
2931
endif()
3032

3133
# Suppress C++-specific OpenCV warning; C compiler rejects it with an error

0 commit comments

Comments
 (0)