Skip to content

Commit

Permalink
Include externals as system headers
Browse files Browse the repository at this point in the history
  • Loading branch information
get committed Apr 15, 2023
1 parent f3dd4ba commit 97e307f
Showing 1 changed file with 54 additions and 54 deletions.
108 changes: 54 additions & 54 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ endif()
if(ENABLE_VTUNE)
set(VTUNE_DIR "/opt/intel/vtune_amplifier")
add_definitions(-DUSE_VTUNE)
include_directories("${VTUNE_DIR}/include")
include_directories(SYSTEM "${VTUNE_DIR}/include")
set(VTUNE_LIBRARIES
"${VTUNE_DIR}/lib64/libjitprofiling.a"
"${VTUNE_DIR}/lib64/libittnotify.a"
Expand Down Expand Up @@ -533,7 +533,7 @@ set(OpenGL_GL_PREFERENCE GLVND CACHE STRING "Linux-only: if GLVND, use the vendo
set_property(CACHE OpenGL_GL_PREFERENCE PROPERTY STRINGS GLVND LEGACY)
find_package(OpenGL)
if (OPENGL_GL)
include_directories(${OPENGL_INCLUDE_DIR})
include_directories(SYSTEM ${OPENGL_INCLUDE_DIR})
endif()

if(ENABLE_X11)
Expand Down Expand Up @@ -636,7 +636,7 @@ if(ENABLE_SDL)
set(SDL_TEST OFF)
set(SDL_TEST_ENABLED_BY_DEFAULT OFF)
set(OPT_DEF_LIBC ON)
add_subdirectory(Externals/SDL/SDL)
add_subdirectory(Externals/SDL/SDL SYSTEM)
if (TARGET SDL2)
dolphin_disable_warnings_msvc(SDL2)
endif()
Expand Down Expand Up @@ -682,32 +682,32 @@ endif()
# Externals/zlib/CMakeLists.txt (that is: NOT in some Src/ subdirectory)
#
if (_M_X86)
add_subdirectory(Externals/Bochs_disasm)
add_subdirectory(Externals/Bochs_disasm SYSTEM)
endif()
add_subdirectory(Externals/cpp-optparse)
add_subdirectory(Externals/cpp-optparse SYSTEM)

find_package(fmt 8)
if(fmt_FOUND)
message(STATUS "Using shared fmt ${fmt_VERSION}")
else()
check_vendoring_approved(fmt)
message(STATUS "Using static fmt from Externals")
add_subdirectory(Externals/fmt EXCLUDE_FROM_ALL)
add_subdirectory(Externals/fmt EXCLUDE_FROM_ALL SYSTEM)
endif()
add_subdirectory(Externals/imgui)
add_subdirectory(Externals/implot)
add_subdirectory(Externals/glslang)
add_subdirectory(Externals/imgui SYSTEM)
add_subdirectory(Externals/implot SYSTEM)
add_subdirectory(Externals/glslang SYSTEM)
# SPIRV-Cross is used on Windows for GLSL to HLSL conversion for the Direct3D 11 and Direct3D 12
# video backends, and on Apple devices for the Metal video backend.
if(WIN32 OR APPLE)
add_subdirectory(Externals/spirv_cross)
add_subdirectory(Externals/spirv_cross SYSTEM)
endif()

if(ENABLE_VULKAN)
add_definitions(-DHAS_VULKAN)

if(APPLE AND USE_BUNDLED_MOLTENVK)
add_subdirectory(Externals/MoltenVK)
add_subdirectory(Externals/MoltenVK SYSTEM)
endif()
endif()

Expand All @@ -720,7 +720,7 @@ find_package(pugixml)
if(NOT pugixml_FOUND)
check_vendoring_approved(pugixml)
message(STATUS "Using static pugixml from Externals")
add_subdirectory(Externals/pugixml)
add_subdirectory(Externals/pugixml SYSTEM)
endif()

if(USE_SHARED_ENET)
Expand All @@ -747,13 +747,13 @@ if (ENET_FOUND)
else()
check_vendoring_approved(enet)
message(STATUS "Using static enet from Externals")
include_directories(Externals/enet/include)
add_subdirectory(Externals/enet)
include_directories(SYSTEM Externals/enet/include)
add_subdirectory(Externals/enet SYSTEM)
endif()

if(NOT XXHASH_FOUND)
message(STATUS "Using static xxhash from Externals")
add_subdirectory(Externals/xxhash)
add_subdirectory(Externals/xxhash SYSTEM)
endif()

find_package(BZip2)
Expand All @@ -762,7 +762,7 @@ if(BZIP2_FOUND)
else()
check_vendoring_approved(bzip2)
message(STATUS "Shared bzip2 not found, falling back to the static library")
add_subdirectory(Externals/bzip2)
add_subdirectory(Externals/bzip2 SYSTEM)
endif()

# macOS ships with liblzma.dylib but no headers, so check for the headers too
Expand All @@ -774,7 +774,7 @@ if(LIBLZMA_FOUND)
else()
check_vendoring_approved(lzma)
message(STATUS "Shared lzma not found, falling back to the static library")
add_subdirectory(Externals/liblzma)
add_subdirectory(Externals/liblzma SYSTEM)
endif()

pkg_check_modules(ZSTD QUIET libzstd>=1.4.0 IMPORTED_TARGET)
Expand All @@ -784,20 +784,20 @@ if(ZSTD_FOUND)
else()
check_vendoring_approved(zstd)
message(STATUS "Shared zstd not found, falling back to the static library")
add_subdirectory(Externals/zstd)
add_subdirectory(Externals/zstd SYSTEM)
endif()

add_subdirectory(Externals/zlib-ng)
add_subdirectory(Externals/zlib-ng SYSTEM)

pkg_check_modules(MINIZIP minizip>=3.0.0)
if(MINIZIP_FOUND)
message(STATUS "Using shared minizip")
include_directories(${MINIZIP_INCLUDE_DIRS})
include_directories(SYSTEM ${MINIZIP_INCLUDE_DIRS})
else()
check_vendoring_approved(minizip)
message(STATUS "Shared minizip not found, falling back to the static library")
add_subdirectory(Externals/minizip)
include_directories(External/minizip)
add_subdirectory(Externals/minizip SYSTEM)
include_directories(SYSTEM External/minizip)
endif()

if(NOT APPLE)
Expand All @@ -808,7 +808,7 @@ if(LZO_FOUND)
else()
check_vendoring_approved(lzo)
message(STATUS "Using static lzo from Externals")
add_subdirectory(Externals/LZO)
add_subdirectory(Externals/LZO SYSTEM)
set(LZO lzo2)
endif()

Expand All @@ -818,33 +818,33 @@ if (pc_spng_FOUND AND TARGET PkgConfig::pc_spng)
set(spng_target PkgConfig::pc_spng)
else()
message(STATUS "Using static libspng from Externals")
add_subdirectory(Externals/libspng)
add_subdirectory(Externals/libspng SYSTEM)
set(spng_target spng)
endif()

# Using static FreeSurround from Externals
# There is no system FreeSurround library.
message(STATUS "Using static FreeSurround from Externals")
add_subdirectory(Externals/FreeSurround)
add_subdirectory(Externals/FreeSurround SYSTEM)

if (APPLE OR WIN32)
message(STATUS "Using ed25519 from Externals")
add_subdirectory(Externals/ed25519)
include_directories(Externals/ed25519)
add_subdirectory(Externals/ed25519 SYSTEM)
include_directories(SYSTEM Externals/ed25519)
endif()

# Using static soundtouch from Externals
# Unable to use system soundtouch library: We require shorts, not floats.
add_subdirectory(Externals/soundtouch)
include_directories(Externals/soundtouch)
add_subdirectory(Externals/soundtouch SYSTEM)
include_directories(SYSTEM Externals/soundtouch)

find_package(CUBEB)
if(CUBEB_FOUND)
message(STATUS "Using the system cubeb")
else()
check_vendoring_approved(cubeb)
message(STATUS "Using static cubeb from Externals")
add_subdirectory(Externals/cubeb EXCLUDE_FROM_ALL)
add_subdirectory(Externals/cubeb EXCLUDE_FROM_ALL SYSTEM)
endif()

if(NOT ANDROID)
Expand All @@ -854,11 +854,11 @@ if(NOT ANDROID)
endif()
if(LIBUSB_FOUND AND NOT APPLE)
message(STATUS "Using shared LibUSB")
include_directories(${LIBUSB_INCLUDE_DIR})
include_directories(SYSTEM ${LIBUSB_INCLUDE_DIR})
else()
check_vendoring_approved(libusb)
message(STATUS "Using static LibUSB from Externals")
add_subdirectory(Externals/libusb)
add_subdirectory(Externals/libusb SYSTEM)
set(LIBUSB_LIBRARIES usb)
endif()
set(LIBUSB_FOUND true)
Expand All @@ -874,8 +874,8 @@ else()
check_vendoring_approved(sfml)
message(STATUS "Using static SFML ${SFML_REQD_VERSION} from Externals")
add_definitions(-DSFML_STATIC)
add_subdirectory(Externals/SFML)
include_directories(BEFORE Externals/SFML/include)
add_subdirectory(Externals/SFML SYSTEM)
include_directories(BEFORE SYSTEM Externals/SFML/include)
endif()

if(USE_UPNP)
Expand All @@ -887,7 +887,7 @@ if(USE_UPNP)
else()
check_vendoring_approved(miniupnpc)
message(STATUS "Using static miniupnpc from Externals")
add_subdirectory(Externals/miniupnpc)
add_subdirectory(Externals/miniupnpc SYSTEM)
endif()
add_definitions(-DUSE_UPNP)
endif()
Expand All @@ -897,25 +897,25 @@ if(NOT APPLE)
endif()
if(MBEDTLS_FOUND)
message(STATUS "Using shared mbed TLS")
include_directories(${MBEDTLS_INCLUDE_DIRS})
include_directories(SYSTEM ${MBEDTLS_INCLUDE_DIRS})
else()
check_vendoring_approved(mbedtls)
message(STATUS "Using static mbed TLS from Externals")
set(MBEDTLS_LIBRARIES mbedtls mbedcrypto mbedx509)
add_subdirectory(Externals/mbedtls/ EXCLUDE_FROM_ALL)
include_directories(Externals/mbedtls/include)
add_subdirectory(Externals/mbedtls/ EXCLUDE_FROM_ALL SYSTEM)
include_directories(SYSTEM Externals/mbedtls/include)
endif()

find_package(CURL)
if(CURL_FOUND)
message(STATUS "Using shared libcurl")
include_directories(${CURL_INCLUDE_DIRS})
include_directories(SYSTEM ${CURL_INCLUDE_DIRS})
else()
check_vendoring_approved(curl)
message(STATUS "Using static libcurl from Externals")
add_subdirectory(Externals/curl)
add_subdirectory(Externals/curl SYSTEM)
set(CURL_LIBRARIES curl)
include_directories(BEFORE Externals/curl/include)
include_directories(BEFORE SYSTEM Externals/curl/include)
endif()

if (NOT ANDROID)
Expand All @@ -928,8 +928,8 @@ if (NOT ANDROID AND ICONV_LIBRARIES AND ICONV_INCLUDE_DIR)
else()
check_vendoring_approved(iconv)
message(STATUS "Using static iconv from Externals")
include_directories(Externals/libiconv-1.14/include)
add_subdirectory(Externals/libiconv-1.14)
include_directories(SYSTEM Externals/libiconv-1.14/include)
add_subdirectory(Externals/libiconv-1.14 SYSTEM)
set(ICONV_LIBRARIES iconv)
endif()

Expand All @@ -938,14 +938,14 @@ if(NOT ANDROID)
if(NOT HIDAPI_FOUND)
check_vendoring_approved(hidapi)
message(STATUS "Using static HIDAPI from Externals")
add_subdirectory(Externals/hidapi EXCLUDE_FROM_ALL)
add_subdirectory(Externals/hidapi EXCLUDE_FROM_ALL SYSTEM)
endif()
endif()

if(USE_DISCORD_PRESENCE)
message(STATUS "Using static DiscordRPC from Externals")
add_subdirectory(Externals/discord-rpc EXCLUDE_FROM_ALL)
include_directories(Externals/discord-rpc/include)
add_subdirectory(Externals/discord-rpc EXCLUDE_FROM_ALL SYSTEM)
include_directories(SYSTEM Externals/discord-rpc/include)
endif()

if(NOT ENABLE_QT)
Expand All @@ -955,7 +955,7 @@ if(USE_MGBA)
find_package(LIBMGBA)
if(NOT LIBMGBA_FOUND)
message(STATUS "Using static libmgba from Externals")
add_subdirectory(Externals/mGBA)
add_subdirectory(Externals/mGBA SYSTEM)
endif()
endif()

Expand All @@ -972,17 +972,17 @@ if(STEAM)
endif()

if (WIN32)
include_directories(Externals/WIL/include)
include_directories(Externals/OpenAL/include)
include_directories(SYSTEM Externals/WIL/include)
include_directories(SYSTEM Externals/OpenAL/include)
endif()

include_directories(Externals/picojson)
include_directories(SYSTEM Externals/picojson)

add_subdirectory(Externals/expr)
add_subdirectory(Externals/expr SYSTEM)

add_subdirectory(Externals/rangeset)
add_subdirectory(Externals/rangeset SYSTEM)

add_subdirectory(Externals/FatFs)
add_subdirectory(Externals/FatFs SYSTEM)

if (USE_RETRO_ACHIEVEMENTS)
add_subdirectory(Externals/rcheevos)
Expand Down Expand Up @@ -1014,7 +1014,7 @@ if(ENABLE_TESTS)
message(STATUS "Using static gtest from Externals")
# Force gtest to link the C runtime dynamically on Windows in order to avoid runtime mismatches.
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
add_subdirectory(Externals/gtest EXCLUDE_FROM_ALL)
add_subdirectory(Externals/gtest EXCLUDE_FROM_ALL SYSTEM)
else()
message(STATUS "Unit tests are disabled")
endif()
Expand Down

0 comments on commit 97e307f

Please sign in to comment.