Skip to content

Commit e4f9853

Browse files
committed
Update CMakeLists.txt
1 parent 28e582f commit e4f9853

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,13 @@ function(disable_target_warnings target_name)
253253
endif()
254254

255255
if(MSVC)
256-
# Use /w (lowercase) to disable all warnings including deprecation warnings
256+
# Remove any existing warning flags set by the target's own CMakeLists
257+
get_target_property(existing_flags ${actual_target} COMPILE_OPTIONS)
258+
if(existing_flags)
259+
list(FILTER existing_flags EXCLUDE REGEX "^/[Ww][0-4]?")
260+
set_target_properties(${actual_target} PROPERTIES COMPILE_OPTIONS "${existing_flags}")
261+
endif()
262+
# Use /w to disable all warnings
257263
target_compile_options(${actual_target} PRIVATE /w)
258264
else()
259265
target_compile_options(${actual_target} PRIVATE -w)

0 commit comments

Comments
 (0)