comparison Resources/CMake/NlohmannJson.cmake @ 0:520cba9a0d42

initial commit
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 13 Jun 2019 14:57:22 +0200
parents
children b388b9d81a1b
comparison
equal deleted inserted replaced
-1:000000000000 0:520cba9a0d42
1 # curl -L https://raw.githubusercontent.com/nlohmann/json/v3.4.0/single_include/nlohmann/json.hpp | gzip -9 > nlohmann-json-3.4.0.gz
2 set(NLOHMANN_JSON_SOURCE ${CMAKE_BINARY_DIR}/nlohmann-json-3.4.0.hpp)
3 set(NLOHMANN_JSON_URL "http://orthanc.osimis.io/ThirdPartyDownloads/google/nlohmann-json-3.4.0.gz")
4 set(NLOHMANN_JSON_MD5 "f3346873ec78a0c90f1f05e4c2575412")
5
6 if (EXISTS "${NLOHMANN_JSON_SOURCE}")
7 set(FirstRun OFF)
8 else()
9 set(FirstRun ON)
10 endif()
11
12 DownloadCompressedFile(${NLOHMANN_JSON_MD5} ${NLOHMANN_JSON_URL} ${NLOHMANN_JSON_SOURCE})
13
14 execute_process(
15 COMMAND ${PATCH_EXECUTABLE} -p0 -N -i
16 ${CMAKE_CURRENT_LIST_DIR}/../Patches/nlohmann-json-3.4.0.patch
17 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
18 RESULT_VARIABLE Failure
19 )
20
21 if (FirstRun AND Failure)
22 message(FATAL_ERROR "Error while patching a file")
23 endif()
24
25 configure_file(
26 ${NLOHMANN_JSON_SOURCE}
27 ${AUTOGENERATED_DIR}/google/cloud/storage/internal/nlohmann_json.hpp
28 )
29
30 include_directories(
31 ${CMAKE_SOURCE_DIR}/external/nlohmann_json/include/
32 )