Skip to content
This repository has been archived by the owner on Jan 3, 2023. It is now read-only.

Commit

Permalink
Patch json library to support older versions of gcc (#598)
Browse files Browse the repository at this point in the history
* patch working

* wip

* fix patcher

* remove debug message:

* cleanup

* fix typo
  • Loading branch information
rkimballn1 authored and diyessi committed Mar 6, 2018
1 parent 4126806 commit 456db62
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
10 changes: 10 additions & 0 deletions cmake/Modules/patch_json.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
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")
8 changes: 7 additions & 1 deletion cmake/external_json.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ if (${CMAKE_VERSION} VERSION_LESS 3.2)
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_MODULE_PATH}patch_json.cmake
)
else()
ExternalProject_Add(
Expand All @@ -44,7 +47,10 @@ else()
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_MODULE_PATH}patch_json.cmake
)
endif()

#------------------------------------------------------------------------------
Expand Down

0 comments on commit 456db62

Please sign in to comment.