Commit f9fd9d4c authored by Sang Ik Lee's avatar Sang Ik Lee Committed by Scott Cyphers

Update "JSON for Modern C++" to a version that officially supports gc… (#1955)

* Update "JSON for Modern C++" to a version that officially supports gcc 4.8

* "JSON for Modern C++" is header only and does not need to be configured.
parent 7a046953
set(FILE_NAME ${CMAKE_BINARY_DIR}/include/nlohmann/detail/macro_scope.hpp)
file(READ ${FILE_NAME} FILE_CONTENTS)
string(REPLACE
"#if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) < 40900"
"#if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) < 40805"
REWRITTEN_FILE
"${FILE_CONTENTS}"
)
file(WRITE ${FILE_NAME} "${REWRITTEN_FILE}")
message(STATUS "json library gcc minimum version number patched")
...@@ -22,40 +22,20 @@ include(ExternalProject) ...@@ -22,40 +22,20 @@ include(ExternalProject)
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
SET(JSON_GIT_REPO_URL https://github.com/nlohmann/json) SET(JSON_GIT_REPO_URL https://github.com/nlohmann/json)
SET(JSON_GIT_LABEL v3.1.1) SET(JSON_GIT_LABEL v3.4.0)
# The 'BUILD_BYPRODUCTS' argument was introduced in CMake 3.2. ExternalProject_Add(
if (${CMAKE_VERSION} VERSION_LESS 3.2)
ExternalProject_Add(
ext_json ext_json
PREFIX json PREFIX json
GIT_REPOSITORY ${JSON_GIT_REPO_URL} GIT_REPOSITORY ${JSON_GIT_REPO_URL}
GIT_TAG ${JSON_GIT_LABEL} GIT_TAG ${JSON_GIT_LABEL}
# Disable install step # Disable install step
CONFIGURE_COMMAND ""
BUILD_COMMAND "" BUILD_COMMAND ""
INSTALL_COMMAND "" INSTALL_COMMAND ""
UPDATE_COMMAND "" UPDATE_COMMAND ""
# cmake does not allow calling cmake functions so we call a cmake script in the Module
# directory.
PATCH_COMMAND ${CMAKE_COMMAND} -P ${CMAKE_SOURCE_DIR}/cmake/Modules/patch_json.cmake
EXCLUDE_FROM_ALL TRUE EXCLUDE_FROM_ALL TRUE
) )
else()
ExternalProject_Add(
ext_json
PREFIX json
GIT_REPOSITORY ${JSON_GIT_REPO_URL}
GIT_TAG ${JSON_GIT_LABEL}
# Disable install step
BUILD_COMMAND ""
INSTALL_COMMAND ""
UPDATE_COMMAND ""
# cmake does not allow calling cmake functions so we call a cmake script in the Module
# directory.
PATCH_COMMAND ${CMAKE_COMMAND} -P ${CMAKE_SOURCE_DIR}/cmake/Modules/patch_json.cmake
EXCLUDE_FROM_ALL TRUE
)
endif()
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment