view Resources/CMake/NlohmannJson.cmake @ 54:509334672b6b default tip

updated copyright, as Orthanc Team now replaces Osimis
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 30 May 2024 22:48:01 +0200
parents f9fe97e893c0
children
line wrap: on
line source

# curl -L https://raw.githubusercontent.com/nlohmann/json/v3.4.0/single_include/nlohmann/json.hpp | gzip -9 > nlohmann-json-3.4.0.gz
set(NLOHMANN_JSON_SOURCE ${CMAKE_BINARY_DIR}/nlohmann-json-3.4.0.hpp)
set(NLOHMANN_JSON_URL "https://orthanc.uclouvain.be/downloads/third-party-downloads/dicom-web/nlohmann-json-3.4.0.gz")
set(NLOHMANN_JSON_MD5 "f3346873ec78a0c90f1f05e4c2575412")

if (EXISTS "${NLOHMANN_JSON_SOURCE}")
  set(FirstRun OFF)
else()
  set(FirstRun ON)
endif()

DownloadCompressedFile(${NLOHMANN_JSON_MD5} ${NLOHMANN_JSON_URL} ${NLOHMANN_JSON_SOURCE})

execute_process(
  COMMAND ${PATCH_EXECUTABLE} -p0 -N -i
  ${CMAKE_CURRENT_LIST_DIR}/../Patches/nlohmann-json-3.4.0.patch
  WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
  RESULT_VARIABLE Failure
  )

if (FirstRun AND Failure)
  message(FATAL_ERROR "Error while patching a file")
endif()

configure_file(
  ${NLOHMANN_JSON_SOURCE}
  ${AUTOGENERATED_DIR}/google/cloud/storage/internal/nlohmann_json.hpp
  )

include_directories(
  ${CMAKE_SOURCE_DIR}/external/nlohmann_json/include/
  )