view Resources/CMake/NlohmannJson.cmake @ 10:340f02ddaabf

build script for Debian stable
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 14 Jun 2019 08:13:01 +0200
parents 520cba9a0d42
children b388b9d81a1b
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/google/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/
  )