summaryrefslogtreecommitdiff
path: root/CMake
diff options
context:
space:
mode:
authorAdmiral H. Curtiss <pikachu025@gmail.com>2022-05-21 15:09:05 +0200
committerAdmiral H. Curtiss <pikachu025@gmail.com>2022-05-22 00:30:56 +0200
commit6ea7af13e87bcde9301507de5ca071d4532a6d8d (patch)
tree53ecd6b1b5ccd64153cb715767de070618d1b8be /CMake
parenta5e85627b04ed8d05ccccfaf0aac5f83ec6ace0c (diff)
cmake: Disable warnings for most externals on MSVC, like we do in the VS project files.
Diffstat (limited to 'CMake')
-rw-r--r--CMake/DolphinDisableWarningsMSVC.cmake18
1 files changed, 18 insertions, 0 deletions
diff --git a/CMake/DolphinDisableWarningsMSVC.cmake b/CMake/DolphinDisableWarningsMSVC.cmake
new file mode 100644
index 0000000000..43823a0ea4
--- /dev/null
+++ b/CMake/DolphinDisableWarningsMSVC.cmake
@@ -0,0 +1,18 @@
+include(RemoveCompileFlag)
+
+macro(dolphin_disable_warnings_msvc _target)
+ if (MSVC)
+ get_target_property(_target_cxx_flags ${_target} COMPILE_OPTIONS)
+ if (_target_cxx_flags)
+ set(new_flags "")
+ foreach(flag IN LISTS _target_cxx_flags)
+ # all warning flags start with "/W" or "/w" or "-W" or "-w"
+ if (NOT "${flag}" MATCHES "^[-/][Ww]")
+ list(APPEND new_flags "${flag}")
+ endif()
+ endforeach()
+ set_target_properties(${_target} PROPERTIES COMPILE_OPTIONS "${new_flags}")
+ endif()
+ target_compile_options(${_target} PRIVATE "/W0")
+ endif()
+endmacro()