include(FetchContent)
set(FETCHCONTENT_QUIET TRUE)

if(POLICY CMP0135)
  cmake_policy(SET CMP0135 NEW)
endif()

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

if(TARGET nlohmann_json)
  target_compile_options(
    nlohmann_json
    INTERFACE $<$<CXX_COMPILER_ID:GNU>:-Wno-deprecated-declarations>
              $<$<CXX_COMPILER_ID:Clang>:-Wno-deprecated-declarations>)
endif()
