DolphinDisableWarningsMSVC.cmake 727 B

123456789101112131415161718192021
  1. include(RemoveCompileFlag)
  2. macro(dolphin_disable_warnings _target)
  3. get_target_property(_target_cxx_flags ${_target} COMPILE_OPTIONS)
  4. if (_target_cxx_flags)
  5. set(new_flags "")
  6. foreach(flag IN LISTS _target_cxx_flags)
  7. # all warning flags start with "/W" or "/w" or "-W" or "-w"
  8. if (NOT "${flag}" MATCHES "^[-/][Ww]")
  9. list(APPEND new_flags "${flag}")
  10. endif()
  11. endforeach()
  12. set_target_properties(${_target} PROPERTIES COMPILE_OPTIONS "${new_flags}")
  13. endif()
  14. if (MSVC)
  15. target_compile_options(${_target} PRIVATE "/W0")
  16. elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU")
  17. target_compile_options(${_target} PRIVATE "-w")
  18. endif()
  19. endmacro()