From 38f310f716e0c82be07ee2867f8765798e4c70c1 Mon Sep 17 00:00:00 2001 From: Castor215 <132155746+Castor215@users.noreply.github.com> Date: Fri, 29 Sep 2023 00:31:14 +0100 Subject: [PATCH] externals: allow users to use system cpp-jwt libraries (#6976) --- CMakeLists.txt | 1 + externals/CMakeLists.txt | 12 +++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d193ab768..23f2a1f40 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -93,6 +93,7 @@ option(USE_SYSTEM_SDL2 "Use the system SDL2 lib (instead of the bundled one)" OF option(USE_SYSTEM_BOOST "Use the system Boost libs (instead of the bundled ones)" OFF) option(USE_SYSTEM_OPENSSL "Use the system OpenSSL libs (instead of the bundled LibreSSL)" OFF) option(USE_SYSTEM_LIBUSB "Use the system libusb (instead of the bundled libusb)" OFF) +option(USE_SYSTEM_CPP_JWT "Use the system cpp-jwt (instead of the bundled one)" OFF) option(USE_SYSTEM_SOUNDTOUCH "Use the system SoundTouch (instead of the bundled one)" OFF) if (CITRA_USE_PRECOMPILED_HEADERS) diff --git a/externals/CMakeLists.txt b/externals/CMakeLists.txt index f11cb2996..25f864e0f 100644 --- a/externals/CMakeLists.txt +++ b/externals/CMakeLists.txt @@ -210,9 +210,15 @@ endif() # cpp-jwt if (ENABLE_WEB_SERVICE) - add_library(cpp-jwt INTERFACE) - target_include_directories(cpp-jwt INTERFACE ./cpp-jwt/include) - target_compile_definitions(cpp-jwt INTERFACE CPP_JWT_USE_VENDORED_NLOHMANN_JSON) + if (USE_SYSTEM_CPP_JWT) + find_package(cpp-jwt REQUIRED) + add_library(cpp-jwt INTERFACE) + target_link_libraries(cpp-jwt INTERFACE cpp-jwt::cpp-jwt) + else() + add_library(cpp-jwt INTERFACE) + target_include_directories(cpp-jwt INTERFACE ./cpp-jwt/include) + target_compile_definitions(cpp-jwt INTERFACE CPP_JWT_USE_VENDORED_NLOHMANN_JSON) + endif() endif() # lodepng