From 2ae9fd83cadaf30cad07f84b59535113215bc833 Mon Sep 17 00:00:00 2001 From: huerni <47264950+huerni@users.noreply.github.com> Date: Thu, 14 Nov 2024 16:28:47 +0800 Subject: [PATCH] refactor: jwt-cpp uses in-project json dependency --- dependencies/cmake/CMakeLists.txt | 1 - dependencies/cmake/jwt-cpp/CMakeLists.txt | 19 +++++++++++++++++++ .../cmake/nlohmann_json/CMakeLists.txt | 19 ------------------- 3 files changed, 19 insertions(+), 20 deletions(-) delete mode 100644 dependencies/cmake/nlohmann_json/CMakeLists.txt diff --git a/dependencies/cmake/CMakeLists.txt b/dependencies/cmake/CMakeLists.txt index 3ca2f774d..1de188d05 100644 --- a/dependencies/cmake/CMakeLists.txt +++ b/dependencies/cmake/CMakeLists.txt @@ -12,7 +12,6 @@ endif () add_subdirectory(BSThreadPool) -# add_subdirectory(nlohmann_json) add_subdirectory(jwt-cpp) add_subdirectory(yaml-cpp) add_subdirectory(fmt) diff --git a/dependencies/cmake/jwt-cpp/CMakeLists.txt b/dependencies/cmake/jwt-cpp/CMakeLists.txt index cc2afc5ff..058e88739 100644 --- a/dependencies/cmake/jwt-cpp/CMakeLists.txt +++ b/dependencies/cmake/jwt-cpp/CMakeLists.txt @@ -1,8 +1,27 @@ include(FetchContent) +if (CRANE_USE_GITEE_SOURCE) + set(JSON_SRC_URL "https://gitee.com/zenglingbo/crane-sched-deps/raw/master/json-3.11.2.tar.gz") +else () + set(JSON_SRC_URL "https://github.com/nlohmann/json/archive/refs/tags/v3.11.2.tar.gz") +endif () set(JWT_CPP_SRC_URL "https://github.com/Thalhammer/jwt-cpp/archive/refs/tags/v0.7.0.tar.gz") +FetchContent_Declare(json + URL ${JSON_SRC_URL} + URL_HASH SHA256=d69f9deb6a75e2580465c6c4c5111b89c4dc2fa94e3a85fcd2ffcd9a143d9273 + INACTIVITY_TIMEOUT 5 + ) + +FetchContent_GetProperties(json) +if (NOT json_POPULATED) + FetchContent_Populate(json) + add_subdirectory(${json_SOURCE_DIR} ${json_BINARY_DIR} EXCLUDE_FROM_ALL) +endif () + +set(nlohmann_json_DIR "${json_BINARY_DIR}") + fetchcontent_declare(jwt-cpp URL ${JWT_CPP_SRC_URL} URL_HASH SHA256=b9eb270e3ba8221e4b2bc38723c9a1cb4fa6c241a42908b9a334daff31137406 diff --git a/dependencies/cmake/nlohmann_json/CMakeLists.txt b/dependencies/cmake/nlohmann_json/CMakeLists.txt deleted file mode 100644 index 853347711..000000000 --- a/dependencies/cmake/nlohmann_json/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -include(FetchContent) - -if (CRANE_USE_GITEE_SOURCE) - set(JSON_SRC_URL "https://gitee.com/zenglingbo/crane-sched-deps/raw/master/json-3.11.2.tar.gz") -else () - set(JSON_SRC_URL "https://github.com/nlohmann/json/archive/refs/tags/v3.11.2.tar.gz") -endif () - -FetchContent_Declare(json - URL ${JSON_SRC_URL} - URL_HASH SHA256=d69f9deb6a75e2580465c6c4c5111b89c4dc2fa94e3a85fcd2ffcd9a143d9273 - INACTIVITY_TIMEOUT 5 - ) - -FetchContent_GetProperties(json) -if (NOT json_POPULATED) - FetchContent_Populate(json) - add_subdirectory(${json_SOURCE_DIR} ${json_BINARY_DIR} EXCLUDE_FROM_ALL) -endif () \ No newline at end of file