Skip to content

Commit

Permalink
only find nlohmann_json test dep when required
Browse files Browse the repository at this point in the history
  • Loading branch information
justend29 committed Apr 18, 2024
1 parent bd682ed commit 16b2f10
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,16 @@ if(JWT_EXTERNAL_PICOJSON)
find_package(picojson 1.3.0 REQUIRED)
endif()

find_package(nlohmann_json CONFIG)

if(NOT nlohmann_json_FOUND)
message(STATUS "jwt-cpp: using FetchContent for nlohmann json")
include(FetchContent)
fetchcontent_declare(nlohmann_json URL https://github.com/nlohmann/json/releases/download/v3.11.2/json.tar.xz
URL_MD5 127794b2c82c0c5693805feaa2a703e2)
fetchcontent_makeavailable(nlohmann_json)
if(JWT_BUILD_EXAMPLES OR JWT_BUILD_TESTS)
find_package(nlohmann_json CONFIG)

if(NOT nlohmann_json_FOUND)
message(STATUS "jwt-cpp: using FetchContent for nlohmann json")
include(FetchContent)
fetchcontent_declare(nlohmann_json URL https://github.com/nlohmann/json/releases/download/v3.11.2/json.tar.xz
URL_MD5 127794b2c82c0c5693805feaa2a703e2)
fetchcontent_makeavailable(nlohmann_json)
endif()
endif()

set(JWT_INCLUDE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/include)
Expand Down

0 comments on commit 16b2f10

Please sign in to comment.