Skip to content

Commit

Permalink
Don't try to FetchContent nlohmann-json if it is already installed. R…
Browse files Browse the repository at this point in the history
…elated to #105
  • Loading branch information
jackjansen committed Apr 30, 2024
1 parent 9298aaf commit 37d69aa
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,18 @@ find_package(PCL REQUIRED COMPONENTS common io octree filters features geometry
#
# Get the nlohmann/json package
#
# Use the next line to get it through normal means
# find_package(nlohmann_json 3.2.0 REQUIRED)
# Or use these lines to fetch it as needed.
# First see if it is already installed.

set(FETCHCONTENT_QUIET OFF)
include(FetchContent)
find_package(nlohmann_json 3.11.2)

FetchContent_Declare(json URL https://github.com/nlohmann/json/releases/download/v3.11.2/json.tar.xz)
FetchContent_MakeAvailable(json)
if(NOT nlohmann_json_FOUND)
# If it is not installed already we download a private copy.
set(FETCHCONTENT_QUIET OFF)
include(FetchContent)

FetchContent_Declare(json URL https://github.com/nlohmann/json/releases/download/v3.11.2/json.tar.xz)
FetchContent_MakeAvailable(json)
endif()

#
# Optional packages, required by some submodules
Expand Down

0 comments on commit 37d69aa

Please sign in to comment.