diff --git a/3rdparty/d3d12memalloc/CMakeLists.txt b/3rdparty/d3d12memalloc/CMakeLists.txt index c0c96d9627..ac9bc5478a 100644 --- a/3rdparty/d3d12memalloc/CMakeLists.txt +++ b/3rdparty/d3d12memalloc/CMakeLists.txt @@ -4,4 +4,4 @@ add_library(D3D12MemAlloc ) target_include_directories(D3D12MemAlloc PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include") - +disable_compiler_warnings_for_target(D3D12MemAlloc) diff --git a/3rdparty/demangler/src/CMakeLists.txt b/3rdparty/demangler/src/CMakeLists.txt index 6d4598224e..196ba681e9 100644 --- a/3rdparty/demangler/src/CMakeLists.txt +++ b/3rdparty/demangler/src/CMakeLists.txt @@ -14,3 +14,4 @@ target_include_directories(demangler PUBLIC ${PROJECT_SOURCE_DIR}/include/) set_property(TARGET demangler PROPERTY CXX_STANDARD 17) set_property(TARGET demangler PROPERTY CXX_STANDARD_REQUIRED ON) +disable_compiler_warnings_for_target(demangler) diff --git a/3rdparty/jpgd/CMakeLists.txt b/3rdparty/jpgd/CMakeLists.txt index d22505b312..26532c77dd 100644 --- a/3rdparty/jpgd/CMakeLists.txt +++ b/3rdparty/jpgd/CMakeLists.txt @@ -9,4 +9,5 @@ add_library(jpgd target_include_directories(jpgd PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}") set_property(TARGET jpgd PROPERTY CXX_STANDARD 17) set_property(TARGET jpgd PROPERTY CXX_STANDARD_REQUIRED ON) +disable_compiler_warnings_for_target(jpgd) diff --git a/3rdparty/libpng/CMakeLists.txt b/3rdparty/libpng/CMakeLists.txt index 4019bd44b0..ea286e36ed 100644 --- a/3rdparty/libpng/CMakeLists.txt +++ b/3rdparty/libpng/CMakeLists.txt @@ -19,3 +19,4 @@ add_library(png target_link_libraries(png PRIVATE ZLIB::ZLIB) target_include_directories(png PUBLIC .) add_library(PNG::PNG ALIAS png) +disable_compiler_warnings_for_target(png) diff --git a/3rdparty/xz/CMakeLists.txt b/3rdparty/xz/CMakeLists.txt index 30091e623a..d5303b725c 100644 --- a/3rdparty/xz/CMakeLists.txt +++ b/3rdparty/xz/CMakeLists.txt @@ -156,3 +156,5 @@ target_include_directories(xz-lzma xz/src/liblzma/simple ) add_library(LibLZMA::LibLZMA ALIAS xz-lzma) + +disable_compiler_warnings_for_target(xz-lzma) diff --git a/3rdparty/zlib/CMakeLists.txt b/3rdparty/zlib/CMakeLists.txt index 99ced658c0..a6dbd260fa 100644 --- a/3rdparty/zlib/CMakeLists.txt +++ b/3rdparty/zlib/CMakeLists.txt @@ -29,3 +29,5 @@ add_library(pcsx2-zlib target_include_directories(pcsx2-zlib PUBLIC .) add_library(ZLIB::ZLIB ALIAS pcsx2-zlib) + +disable_compiler_warnings_for_target(pcsx2-zlib) diff --git a/cmake/Pcsx2Utils.cmake b/cmake/Pcsx2Utils.cmake index 82fea16f48..4ef3cdf35b 100644 --- a/cmake/Pcsx2Utils.cmake +++ b/cmake/Pcsx2Utils.cmake @@ -256,3 +256,11 @@ function(fixup_file_properties target) endforeach() endif() endfunction() + +function(disable_compiler_warnings_for_target target) + if(MSVC) + target_compile_options(${target} PRIVATE "/W0") + else() + target_compile_options(${target} PRIVATE "-w") + endif() +endfunction() diff --git a/cmake/SearchForStuff.cmake b/cmake/SearchForStuff.cmake index b9d1dee61d..319659a7c6 100644 --- a/cmake/SearchForStuff.cmake +++ b/cmake/SearchForStuff.cmake @@ -177,6 +177,7 @@ add_subdirectory(3rdparty/jpgd EXCLUDE_FROM_ALL) add_subdirectory(3rdparty/simpleini EXCLUDE_FROM_ALL) add_subdirectory(3rdparty/imgui EXCLUDE_FROM_ALL) add_subdirectory(3rdparty/cpuinfo EXCLUDE_FROM_ALL) +disable_compiler_warnings_for_target(cpuinfo) add_subdirectory(3rdparty/zydis EXCLUDE_FROM_ALL) add_subdirectory(3rdparty/zstd EXCLUDE_FROM_ALL) add_subdirectory(3rdparty/libzip EXCLUDE_FROM_ALL) @@ -192,7 +193,12 @@ endif() if(CUBEB_API) add_subdirectory(3rdparty/cubeb EXCLUDE_FROM_ALL) - target_compile_options(cubeb PRIVATE "-w") - target_compile_options(speex PRIVATE "-w") + disable_compiler_warnings_for_target(cubeb) + disable_compiler_warnings_for_target(speex) endif() +# Deliberately at the end. We don't want to set the flag on third-party projects. +if(MSVC) + # Don't warn about "deprecated" POSIX functions. + add_definitions("-D_CRT_SECURE_NO_WARNINGS" "-DCRT_SECURE_NO_DEPRECATE") +endif()