Build: Silence warnings in third-party projects

This commit is contained in:
Stenzek 2023-08-26 13:25:24 +10:00 committed by Connor McLaughlin
parent 02b64f4027
commit e3a1125e84
8 changed files with 24 additions and 3 deletions

View File

@ -4,4 +4,4 @@ add_library(D3D12MemAlloc
)
target_include_directories(D3D12MemAlloc PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include")
disable_compiler_warnings_for_target(D3D12MemAlloc)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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()

View File

@ -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()