CMake: Disable warnings on third-party projects

This commit is contained in:
Stenzek 2023-09-30 15:39:52 +10:00
parent 34aa419e92
commit e6bfcf22d9
3 changed files with 32 additions and 0 deletions

View File

@ -11,6 +11,7 @@ message("Build Type: ${CMAKE_BUILD_TYPE}")
# Pull in modules.
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMakeModules/")
include(DuckStationUtils)
# Platform detection.
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")

View File

@ -0,0 +1,7 @@
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

@ -1,49 +1,73 @@
add_subdirectory(fmt EXCLUDE_FROM_ALL)
disable_compiler_warnings_for_target(fmt)
add_subdirectory(stb EXCLUDE_FROM_ALL)
disable_compiler_warnings_for_target(stb)
add_subdirectory(zlib EXCLUDE_FROM_ALL)
disable_compiler_warnings_for_target(zlib)
add_subdirectory(zstd EXCLUDE_FROM_ALL)
disable_compiler_warnings_for_target(zstd)
add_subdirectory(minizip EXCLUDE_FROM_ALL)
disable_compiler_warnings_for_target(minizip)
add_subdirectory(lzma EXCLUDE_FROM_ALL)
disable_compiler_warnings_for_target(lzma)
add_subdirectory(libchdr EXCLUDE_FROM_ALL)
disable_compiler_warnings_for_target(libchdr)
add_subdirectory(xxhash EXCLUDE_FROM_ALL)
disable_compiler_warnings_for_target(xxhash)
add_subdirectory(rapidjson EXCLUDE_FROM_ALL)
add_subdirectory(glslang EXCLUDE_FROM_ALL)
disable_compiler_warnings_for_target(glslang)
add_subdirectory(imgui EXCLUDE_FROM_ALL)
disable_compiler_warnings_for_target(imgui)
add_subdirectory(simpleini EXCLUDE_FROM_ALL)
disable_compiler_warnings_for_target(simpleini)
add_subdirectory(vulkan EXCLUDE_FROM_ALL)
add_subdirectory(soundtouch EXCLUDE_FROM_ALL)
disable_compiler_warnings_for_target(soundtouch)
add_subdirectory(googletest EXCLUDE_FROM_ALL)
add_subdirectory(cpuinfo EXCLUDE_FROM_ALL)
disable_compiler_warnings_for_target(cpuinfo)
add_subdirectory(fast_float EXCLUDE_FROM_ALL)
add_subdirectory(reshadefx EXCLUDE_FROM_ALL)
disable_compiler_warnings_for_target(reshadefx)
add_subdirectory(rcheevos EXCLUDE_FROM_ALL)
disable_compiler_warnings_for_target(rcheevos)
if(ENABLE_CUBEB)
add_subdirectory(cubeb EXCLUDE_FROM_ALL)
disable_compiler_warnings_for_target(cubeb)
disable_compiler_warnings_for_target(speex)
endif()
if(ENABLE_OPENGL)
add_subdirectory(glad EXCLUDE_FROM_ALL)
disable_compiler_warnings_for_target(glad)
endif()
if(ENABLE_DISCORD_PRESENCE)
add_subdirectory(discord-rpc EXCLUDE_FROM_ALL)
disable_compiler_warnings_for_target(discord-rpc)
endif()
if(${CPU_ARCH} STREQUAL "aarch32" OR ${CPU_ARCH} STREQUAL "aarch64")
add_subdirectory(vixl EXCLUDE_FROM_ALL)
disable_compiler_warnings_for_target(vixl)
endif()
if(${CPU_ARCH} STREQUAL "riscv64")
add_subdirectory(biscuit EXCLUDE_FROM_ALL)
disable_compiler_warnings_for_target(biscuit)
add_subdirectory(riscv-disas EXCLUDE_FROM_ALL)
disable_compiler_warnings_for_target(riscv-disas)
endif()
if(WIN32)
add_subdirectory(d3d12ma EXCLUDE_FROM_ALL)
disable_compiler_warnings_for_target(d3d12ma)
add_subdirectory(winpixeventruntime EXCLUDE_FROM_ALL)
endif()
if(APPLE)
add_subdirectory(spirv-cross EXCLUDE_FROM_ALL)
disable_compiler_warnings_for_target(spriv-cross)
endif()