mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 13:27:45 -07:00
cmake: Disable warnings for most externals on MSVC, like we do in the VS project files.
This commit is contained in:
parent
a5e85627b0
commit
6ea7af13e8
18
CMake/DolphinDisableWarningsMSVC.cmake
Normal file
18
CMake/DolphinDisableWarningsMSVC.cmake
Normal file
@ -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()
|
@ -128,6 +128,7 @@ include(CheckAndAddFlag)
|
||||
include(CheckCCompilerFlag)
|
||||
include(CheckVendoringApproved)
|
||||
include(DolphinCompileDefinitions)
|
||||
include(DolphinDisableWarningsMSVC)
|
||||
include(RemoveCompileFlag)
|
||||
|
||||
# Enable folders for IDE
|
||||
|
1
Externals/Bochs_disasm/CMakeLists.txt
vendored
1
Externals/Bochs_disasm/CMakeLists.txt
vendored
@ -4,6 +4,7 @@ add_library(bdisasm STATIC
|
||||
resolve.cc
|
||||
syntax.cc
|
||||
)
|
||||
dolphin_disable_warnings_msvc(bdisasm)
|
||||
|
||||
if (WIN32)
|
||||
target_sources(bdisasm
|
||||
|
1
Externals/FreeSurround/CMakeLists.txt
vendored
1
Externals/FreeSurround/CMakeLists.txt
vendored
@ -12,5 +12,6 @@ set(SRCS
|
||||
)
|
||||
|
||||
add_library(FreeSurround STATIC ${SRCS})
|
||||
dolphin_disable_warnings_msvc(FreeSurround)
|
||||
target_include_directories(FreeSurround PUBLIC include)
|
||||
target_compile_options(FreeSurround PRIVATE -w)
|
||||
|
1
Externals/LZO/CMakeLists.txt
vendored
1
Externals/LZO/CMakeLists.txt
vendored
@ -1,6 +1,7 @@
|
||||
add_library(lzo2 STATIC
|
||||
minilzo.c
|
||||
)
|
||||
dolphin_disable_warnings_msvc(lzo2)
|
||||
|
||||
target_include_directories(lzo2
|
||||
PUBLIC
|
||||
|
2
Externals/SFML/CMakeLists.txt
vendored
2
Externals/SFML/CMakeLists.txt
vendored
@ -25,3 +25,5 @@ set(SRC_SYSTEM
|
||||
|
||||
add_library(sfml-network ${SRC_NETWORK})
|
||||
add_library(sfml-system ${SRC_SYSTEM})
|
||||
dolphin_disable_warnings_msvc(sfml-network)
|
||||
dolphin_disable_warnings_msvc(sfml-system)
|
||||
|
1
Externals/bzip2/CMakeLists.txt
vendored
1
Externals/bzip2/CMakeLists.txt
vendored
@ -70,6 +70,7 @@ set(BZIP2_SRCS
|
||||
|
||||
add_library(bzip2 STATIC ${BZIP2_SRCS} ${BZIP2_PUBLIC_HDRS} ${BZIP2_PRIVATE_HDRS})
|
||||
add_library(BZip2::BZip2 ALIAS bzip2)
|
||||
dolphin_disable_warnings_msvc(bzip2)
|
||||
|
||||
target_include_directories(bzip2
|
||||
PUBLIC
|
||||
|
1
Externals/cpp-optparse/CMakeLists.txt
vendored
1
Externals/cpp-optparse/CMakeLists.txt
vendored
@ -3,4 +3,5 @@ check_and_add_flag(CXX11 -std=c++11)
|
||||
set(SRCS OptionParser.cpp OptionParser.h)
|
||||
|
||||
add_library(cpp-optparse STATIC ${SRCS})
|
||||
dolphin_disable_warnings_msvc(cpp-optparse)
|
||||
target_include_directories(cpp-optparse PUBLIC .)
|
||||
|
2
Externals/cubeb/CMakeLists.txt
vendored
2
Externals/cubeb/CMakeLists.txt
vendored
@ -48,6 +48,7 @@ add_library(cubeb
|
||||
src/cubeb_log.cpp
|
||||
src/cubeb_strings.c
|
||||
$<TARGET_OBJECTS:speex>)
|
||||
dolphin_disable_warnings_msvc(cubeb)
|
||||
target_include_directories(cubeb
|
||||
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> $<INSTALL_INTERFACE:include>
|
||||
)
|
||||
@ -100,6 +101,7 @@ install(
|
||||
|
||||
add_library(speex OBJECT
|
||||
src/speex/resample.c)
|
||||
dolphin_disable_warnings_msvc(speex)
|
||||
set_target_properties(speex PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
|
||||
target_compile_definitions(speex PRIVATE OUTSIDE_SPEEX)
|
||||
target_compile_definitions(speex PRIVATE FLOATING_POINT)
|
||||
|
1
Externals/curl/lib/CMakeLists.txt
vendored
1
Externals/curl/lib/CMakeLists.txt
vendored
@ -12,6 +12,7 @@ add_library(
|
||||
STATIC
|
||||
${SRCS}
|
||||
)
|
||||
dolphin_disable_warnings_msvc(curl)
|
||||
|
||||
target_link_libraries(curl ${MBEDTLS_LIBRARIES} z)
|
||||
target_compile_definitions(curl PUBLIC CURL_STATICLIB PRIVATE CURL_DISABLE_LDAP)
|
||||
|
1
Externals/discord-rpc/src/CMakeLists.txt
vendored
1
Externals/discord-rpc/src/CMakeLists.txt
vendored
@ -31,6 +31,7 @@ if(WIN32)
|
||||
add_definitions(-DDISCORD_WINDOWS)
|
||||
set(BASE_RPC_SRC ${BASE_RPC_SRC} connection_win.cpp discord_register_win.cpp)
|
||||
add_library(discord-rpc ${BASE_RPC_SRC})
|
||||
dolphin_disable_warnings_msvc(discord-rpc)
|
||||
if (MSVC)
|
||||
if(USE_STATIC_CRT)
|
||||
foreach(CompilerFlag
|
||||
|
1
Externals/ed25519/CMakeLists.txt
vendored
1
Externals/ed25519/CMakeLists.txt
vendored
@ -11,3 +11,4 @@ add_library(ed25519
|
||||
sc.c
|
||||
sha512.c
|
||||
verify.c)
|
||||
dolphin_disable_warnings_msvc(ed25519)
|
||||
|
1
Externals/enet/CMakeLists.txt
vendored
1
Externals/enet/CMakeLists.txt
vendored
@ -72,6 +72,7 @@ add_library(enet STATIC
|
||||
unix.c
|
||||
win32.c
|
||||
)
|
||||
dolphin_disable_warnings_msvc(enet)
|
||||
if(HAIKU)
|
||||
target_link_libraries(enet network)
|
||||
endif(HAIKU)
|
||||
|
1
Externals/fmt/CMakeLists.txt
vendored
1
Externals/fmt/CMakeLists.txt
vendored
@ -229,6 +229,7 @@ else()
|
||||
endif ()
|
||||
|
||||
add_library(fmt ${FMT_SOURCES} ${FMT_HEADERS} README.rst ChangeLog.rst)
|
||||
dolphin_disable_warnings_msvc(fmt)
|
||||
add_library(fmt::fmt ALIAS fmt)
|
||||
|
||||
if (FMT_WERROR)
|
||||
|
1
Externals/glslang/CMakeLists.txt
vendored
1
Externals/glslang/CMakeLists.txt
vendored
@ -73,6 +73,7 @@ endif()
|
||||
endif()
|
||||
|
||||
add_library(glslang STATIC ${SRCS})
|
||||
dolphin_disable_warnings_msvc(glslang)
|
||||
|
||||
target_include_directories(glslang
|
||||
PRIVATE
|
||||
|
1
Externals/hidapi/CMakeLists.txt
vendored
1
Externals/hidapi/CMakeLists.txt
vendored
@ -1,6 +1,7 @@
|
||||
project(hidapi)
|
||||
|
||||
add_library(hidapi STATIC hidapi/hidapi.h)
|
||||
dolphin_disable_warnings_msvc(hidapi)
|
||||
target_include_directories(hidapi PUBLIC hidapi)
|
||||
|
||||
if(APPLE)
|
||||
|
1
Externals/imgui/CMakeLists.txt
vendored
1
Externals/imgui/CMakeLists.txt
vendored
@ -12,6 +12,7 @@ set(SRCS
|
||||
)
|
||||
|
||||
add_library(imgui STATIC ${SRCS})
|
||||
dolphin_disable_warnings_msvc(imgui)
|
||||
target_include_directories(imgui PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
|
||||
target_link_libraries(imgui
|
||||
|
1
Externals/libiconv-1.14/CMakeLists.txt
vendored
1
Externals/libiconv-1.14/CMakeLists.txt
vendored
@ -7,3 +7,4 @@ set(SRCS lib/iconv.c
|
||||
)
|
||||
|
||||
add_library(iconv STATIC ${SRCS})
|
||||
dolphin_disable_warnings_msvc(iconv)
|
||||
|
1
Externals/liblzma/CMakeLists.txt
vendored
1
Externals/liblzma/CMakeLists.txt
vendored
@ -207,6 +207,7 @@ set(LZMA_SRCS
|
||||
|
||||
add_library(lzma STATIC ${LZMA_SRCS} ${LZMA_PUBLIC_HDRS})
|
||||
add_library(LibLZMA::LibLZMA ALIAS lzma)
|
||||
dolphin_disable_warnings_msvc(lzma)
|
||||
|
||||
target_compile_definitions(lzma PUBLIC LZMA_API_STATIC)
|
||||
|
||||
|
2
Externals/libpng/CMakeLists.txt
vendored
2
Externals/libpng/CMakeLists.txt
vendored
@ -39,6 +39,8 @@ add_library(png STATIC
|
||||
pngwutil.c
|
||||
)
|
||||
|
||||
dolphin_disable_warnings_msvc(png)
|
||||
|
||||
option(PNG_HARDWARE_OPTIMIZATIONS "Enable hardware optimizations for libpng" OFF)
|
||||
|
||||
if(PNG_HARDWARE_OPTIMIZATIONS)
|
||||
|
2
Externals/libusb/CMakeLists.txt
vendored
2
Externals/libusb/CMakeLists.txt
vendored
@ -6,6 +6,8 @@ add_library(usb STATIC EXCLUDE_FROM_ALL
|
||||
libusb/libusb/strerror.c
|
||||
libusb/libusb/sync.c
|
||||
)
|
||||
dolphin_disable_warnings_msvc(usb)
|
||||
|
||||
set_target_properties(usb PROPERTIES VERSION 1.0.26)
|
||||
if(WIN32)
|
||||
target_include_directories(usb BEFORE PUBLIC libusb/libusb PRIVATE libusb/msvc)
|
||||
|
1
Externals/mGBA/CMakeLists.txt
vendored
1
Externals/mGBA/CMakeLists.txt
vendored
@ -1,6 +1,7 @@
|
||||
set(LIBMGBA_ONLY ON)
|
||||
set(USE_LZMA ON)
|
||||
add_subdirectory(mgba EXCLUDE_FROM_ALL)
|
||||
dolphin_disable_warnings_msvc(mgba)
|
||||
|
||||
if(NOT MSVC)
|
||||
target_compile_options(mgba PRIVATE -Wno-unused-parameter -Wno-unused-result -Wno-unused-variable)
|
||||
|
6
Externals/mbedtls/library/CMakeLists.txt
vendored
6
Externals/mbedtls/library/CMakeLists.txt
vendored
@ -189,28 +189,34 @@ endif()
|
||||
|
||||
if(USE_STATIC_MBEDTLS_LIBRARY)
|
||||
add_library(${mbedcrypto_static_target} STATIC ${src_crypto})
|
||||
dolphin_disable_warnings_msvc(${mbedcrypto_static_target})
|
||||
set_target_properties(${mbedcrypto_static_target} PROPERTIES OUTPUT_NAME mbedcrypto)
|
||||
target_link_libraries(${mbedcrypto_static_target} PUBLIC ${libs})
|
||||
|
||||
add_library(${mbedx509_static_target} STATIC ${src_x509})
|
||||
dolphin_disable_warnings_msvc(${mbedx509_static_target})
|
||||
set_target_properties(${mbedx509_static_target} PROPERTIES OUTPUT_NAME mbedx509)
|
||||
target_link_libraries(${mbedx509_static_target} PUBLIC ${libs} ${mbedcrypto_static_target})
|
||||
|
||||
add_library(${mbedtls_static_target} STATIC ${src_tls})
|
||||
dolphin_disable_warnings_msvc(${mbedtls_static_target})
|
||||
set_target_properties(${mbedtls_static_target} PROPERTIES OUTPUT_NAME mbedtls)
|
||||
target_link_libraries(${mbedtls_static_target} PUBLIC ${libs} ${mbedx509_static_target})
|
||||
endif(USE_STATIC_MBEDTLS_LIBRARY)
|
||||
|
||||
if(USE_SHARED_MBEDTLS_LIBRARY)
|
||||
add_library(${mbedcrypto_target} SHARED ${src_crypto})
|
||||
dolphin_disable_warnings_msvc(${mbedcrypto_target})
|
||||
set_target_properties(${mbedcrypto_target} PROPERTIES VERSION 2.28.0 SOVERSION 7)
|
||||
target_link_libraries(${mbedcrypto_target} PUBLIC ${libs})
|
||||
|
||||
add_library(${mbedx509_target} SHARED ${src_x509})
|
||||
dolphin_disable_warnings_msvc(${mbedx509_target})
|
||||
set_target_properties(${mbedx509_target} PROPERTIES VERSION 2.28.0 SOVERSION 1)
|
||||
target_link_libraries(${mbedx509_target} PUBLIC ${libs} ${mbedcrypto_target})
|
||||
|
||||
add_library(${mbedtls_target} SHARED ${src_tls})
|
||||
dolphin_disable_warnings_msvc(${mbedtls_target})
|
||||
set_target_properties(${mbedtls_target} PROPERTIES VERSION 2.28.0 SOVERSION 14)
|
||||
target_link_libraries(${mbedtls_target} PUBLIC ${libs} ${mbedx509_target})
|
||||
endif(USE_SHARED_MBEDTLS_LIBRARY)
|
||||
|
1
Externals/miniupnpc/CMakeLists.txt
vendored
1
Externals/miniupnpc/CMakeLists.txt
vendored
@ -33,6 +33,7 @@ set(SRCS src/igd_desc_parse.c
|
||||
src/receivedata.c)
|
||||
|
||||
add_library(miniupnpc STATIC ${SRCS})
|
||||
dolphin_disable_warnings_msvc(miniupnpc)
|
||||
target_include_directories(miniupnpc PUBLIC src)
|
||||
|
||||
add_library(Miniupnpc::miniupnpc ALIAS miniupnpc)
|
||||
|
1
Externals/minizip/CMakeLists.txt
vendored
1
Externals/minizip/CMakeLists.txt
vendored
@ -26,6 +26,7 @@ add_library(minizip STATIC
|
||||
unzip.h
|
||||
zip.h
|
||||
)
|
||||
dolphin_disable_warnings_msvc(minizip)
|
||||
|
||||
if (UNIX)
|
||||
target_sources(minizip PRIVATE
|
||||
|
1
Externals/pugixml/CMakeLists.txt
vendored
1
Externals/pugixml/CMakeLists.txt
vendored
@ -35,6 +35,7 @@ if(BUILD_SHARED_LIBS)
|
||||
else()
|
||||
add_library(pugixml STATIC ${SOURCES})
|
||||
endif()
|
||||
dolphin_disable_warnings_msvc(pugixml)
|
||||
|
||||
set_target_properties(pugixml PROPERTIES VERSION 1.8 SOVERSION 1)
|
||||
get_target_property(PUGIXML_VERSION_STRING pugixml VERSION)
|
||||
|
1
Externals/soundtouch/CMakeLists.txt
vendored
1
Externals/soundtouch/CMakeLists.txt
vendored
@ -16,4 +16,5 @@ set(SRCS
|
||||
)
|
||||
|
||||
add_library(SoundTouch STATIC ${SRCS})
|
||||
dolphin_disable_warnings_msvc(SoundTouch)
|
||||
add_definitions(-w)
|
||||
|
1
Externals/xxhash/CMakeLists.txt
vendored
1
Externals/xxhash/CMakeLists.txt
vendored
@ -1,6 +1,7 @@
|
||||
project(xxhash C)
|
||||
|
||||
add_library(xxhash STATIC xxhash.c)
|
||||
dolphin_disable_warnings_msvc(xxhash)
|
||||
target_include_directories(xxhash
|
||||
PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
|
1
Externals/zlib/CMakeLists.txt
vendored
1
Externals/zlib/CMakeLists.txt
vendored
@ -86,6 +86,7 @@ set(ZLIB_SRCS
|
||||
)
|
||||
|
||||
add_library(z STATIC ${ZLIB_SRCS} ${ZLIB_DLL_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
|
||||
dolphin_disable_warnings_msvc(z)
|
||||
add_library(ZLIB::ZLIB ALIAS z)
|
||||
|
||||
target_include_directories(z
|
||||
|
1
Externals/zstd/CMakeLists.txt
vendored
1
Externals/zstd/CMakeLists.txt
vendored
@ -115,6 +115,7 @@ set(ZSTD_SRCS
|
||||
)
|
||||
|
||||
add_library(zstd STATIC ${ZSTD_SRCS} ${ZSTD_PUBLIC_HDRS} ${ZSTD_PRIVATE_HDRS})
|
||||
dolphin_disable_warnings_msvc(zstd)
|
||||
add_library(zstd::zstd ALIAS zstd)
|
||||
|
||||
target_include_directories(zstd
|
||||
|
Loading…
Reference in New Issue
Block a user