view Resources/CMake/NlohmannJson.cmake @ 20:a2c57c351627 OrthancGoogleCloudPlatform-1.0

add windows resources
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 26 Jun 2019 15:53:09 +0200
parents b388b9d81a1b
children f9fe97e893c0
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 "http://orthanc.osimis.io/ThirdPartyDownloads/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/
  )