mirror of
https://github.com/izzy2lost/dolphin.git
synced 2026-06-19 01:16:48 -07:00
Merge pull request #12651 from jordan-woyak/silence-externals-warnings
CMake: Hide warnings in Externals also for non-msvc.
This commit is contained in:
@@ -1,18 +1,20 @@
|
||||
include(RemoveCompileFlag)
|
||||
|
||||
macro(dolphin_disable_warnings_msvc _target)
|
||||
macro(dolphin_disable_warnings _target)
|
||||
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()
|
||||
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")
|
||||
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
||||
target_compile_options(${_target} PRIVATE "-w")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ add_library(bdisasm STATIC
|
||||
resolve.cc
|
||||
syntax.cc
|
||||
)
|
||||
dolphin_disable_warnings_msvc(bdisasm)
|
||||
dolphin_disable_warnings(bdisasm)
|
||||
|
||||
if (WIN32)
|
||||
target_sources(bdisasm
|
||||
|
||||
+1
-1
@@ -12,6 +12,6 @@ set(SRCS
|
||||
)
|
||||
|
||||
add_library(FreeSurround STATIC ${SRCS})
|
||||
dolphin_disable_warnings_msvc(FreeSurround)
|
||||
dolphin_disable_warnings(FreeSurround)
|
||||
target_include_directories(FreeSurround PUBLIC include)
|
||||
target_compile_options(FreeSurround PRIVATE -w)
|
||||
|
||||
Vendored
+1
-1
@@ -1,7 +1,7 @@
|
||||
add_library(lzo2 STATIC
|
||||
minilzo.c
|
||||
)
|
||||
dolphin_disable_warnings_msvc(lzo2)
|
||||
dolphin_disable_warnings(lzo2)
|
||||
|
||||
target_include_directories(lzo2
|
||||
PUBLIC
|
||||
|
||||
Vendored
+2
-2
@@ -10,8 +10,8 @@ set(SDL_TEST_ENABLED_BY_DEFAULT OFF)
|
||||
set(OPT_DEF_LIBC ON)
|
||||
add_subdirectory(SDL)
|
||||
if (TARGET SDL2)
|
||||
dolphin_disable_warnings_msvc(SDL2)
|
||||
dolphin_disable_warnings(SDL2)
|
||||
endif()
|
||||
if (TARGET SDL2-static)
|
||||
dolphin_disable_warnings_msvc(SDL2-static)
|
||||
dolphin_disable_warnings(SDL2-static)
|
||||
endif()
|
||||
|
||||
Vendored
+2
-2
@@ -27,5 +27,5 @@ target_compile_definitions(sfml-system PUBLIC SFML_STATIC)
|
||||
target_include_directories(sfml-system PUBLIC include PRIVATE src)
|
||||
target_include_directories(sfml-network PUBLIC include PRIVATE src)
|
||||
target_link_libraries(sfml-network PUBLIC sfml-system)
|
||||
dolphin_disable_warnings_msvc(sfml-network)
|
||||
dolphin_disable_warnings_msvc(sfml-system)
|
||||
dolphin_disable_warnings(sfml-network)
|
||||
dolphin_disable_warnings(sfml-system)
|
||||
|
||||
Vendored
+1
-1
@@ -70,7 +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)
|
||||
dolphin_disable_warnings(bzip2)
|
||||
|
||||
target_include_directories(bzip2
|
||||
PUBLIC
|
||||
|
||||
+1
-1
@@ -3,5 +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)
|
||||
dolphin_disable_warnings(cpp-optparse)
|
||||
target_include_directories(cpp-optparse PUBLIC .)
|
||||
|
||||
Vendored
+2
-2
@@ -69,7 +69,7 @@ add_library(cubeb
|
||||
cubeb/src/cubeb_strings.c
|
||||
cubeb/src/cubeb_utils.cpp
|
||||
)
|
||||
dolphin_disable_warnings_msvc(cubeb)
|
||||
dolphin_disable_warnings(cubeb)
|
||||
target_include_directories(cubeb
|
||||
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/cubeb/include> $<INSTALL_INTERFACE:include>
|
||||
)
|
||||
@@ -127,7 +127,7 @@ endif()
|
||||
|
||||
if(NOT TARGET speex)
|
||||
add_library(speex OBJECT cubeb/subprojects/speex/resample.c)
|
||||
dolphin_disable_warnings_msvc(speex)
|
||||
dolphin_disable_warnings(speex)
|
||||
set_target_properties(speex PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
|
||||
target_include_directories(speex INTERFACE cubeb/subprojects)
|
||||
target_compile_definitions(speex PUBLIC
|
||||
|
||||
Vendored
+1
-1
@@ -45,7 +45,7 @@ if(NOT CURL_CA_PATH_SET)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
dolphin_disable_warnings_msvc(curl)
|
||||
dolphin_disable_warnings(curl)
|
||||
target_link_libraries(curl ${CURL_LIBS})
|
||||
target_include_directories(curl PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/curl/include")
|
||||
target_compile_definitions(curl PRIVATE "BUILDING_LIBCURL=1")
|
||||
|
||||
+1
-1
@@ -31,7 +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)
|
||||
dolphin_disable_warnings(discord-rpc)
|
||||
if (MSVC)
|
||||
if(USE_STATIC_CRT)
|
||||
foreach(CompilerFlag
|
||||
|
||||
Vendored
+1
-1
@@ -11,4 +11,4 @@ add_library(ed25519
|
||||
sc.c
|
||||
sha512.c
|
||||
verify.c)
|
||||
dolphin_disable_warnings_msvc(ed25519)
|
||||
dolphin_disable_warnings(ed25519)
|
||||
|
||||
Vendored
+1
-1
@@ -92,7 +92,7 @@ add_library(enet STATIC
|
||||
)
|
||||
target_include_directories(enet PUBLIC enet/include)
|
||||
|
||||
dolphin_disable_warnings_msvc(enet)
|
||||
dolphin_disable_warnings(enet)
|
||||
add_library(enet::enet ALIAS enet)
|
||||
|
||||
if (MINGW)
|
||||
|
||||
Vendored
+1
-1
@@ -1,2 +1,2 @@
|
||||
add_subdirectory(fmt)
|
||||
dolphin_disable_warnings_msvc(fmt)
|
||||
dolphin_disable_warnings(fmt)
|
||||
|
||||
Vendored
+1
-1
@@ -73,7 +73,7 @@ endif()
|
||||
endif()
|
||||
|
||||
add_library(glslang STATIC ${SRCS})
|
||||
dolphin_disable_warnings_msvc(glslang)
|
||||
dolphin_disable_warnings(glslang)
|
||||
|
||||
target_include_directories(glslang
|
||||
PRIVATE
|
||||
|
||||
Vendored
+1
-1
@@ -1,7 +1,7 @@
|
||||
project(hidapi)
|
||||
|
||||
add_library(hidapi STATIC hidapi-src/hidapi/hidapi.h)
|
||||
dolphin_disable_warnings_msvc(hidapi)
|
||||
dolphin_disable_warnings(hidapi)
|
||||
target_include_directories(hidapi PUBLIC hidapi-src/hidapi)
|
||||
|
||||
if(APPLE)
|
||||
|
||||
Vendored
+1
-1
@@ -13,7 +13,7 @@ set(SRCS
|
||||
)
|
||||
|
||||
add_library(imgui STATIC ${SRCS})
|
||||
dolphin_disable_warnings_msvc(imgui)
|
||||
dolphin_disable_warnings(imgui)
|
||||
target_include_directories(imgui PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
|
||||
target_link_libraries(imgui
|
||||
|
||||
Vendored
+1
-1
@@ -10,7 +10,7 @@ set(SRCS
|
||||
)
|
||||
|
||||
add_library(implot STATIC ${SRCS})
|
||||
dolphin_disable_warnings_msvc(implot)
|
||||
dolphin_disable_warnings(implot)
|
||||
target_include_directories(implot
|
||||
PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/implot"
|
||||
PRIVATE imgui
|
||||
|
||||
+1
-1
@@ -9,5 +9,5 @@ target_include_directories(iconv
|
||||
PRIVATE
|
||||
libcharset/include
|
||||
)
|
||||
dolphin_disable_warnings_msvc(iconv)
|
||||
dolphin_disable_warnings(iconv)
|
||||
add_library(Iconv::Iconv ALIAS iconv)
|
||||
|
||||
Vendored
+1
-1
@@ -207,7 +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)
|
||||
dolphin_disable_warnings(lzma)
|
||||
|
||||
target_compile_definitions(lzma PUBLIC LZMA_API_STATIC)
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user