From 8c9c3b4597a81a1cd77ed49a7451bf1a6eeeb4a6 Mon Sep 17 00:00:00 2001
From: Rye Mutt <rye@alchemyviewer.org>
Date: Thu, 12 Dec 2019 02:36:43 -0500
Subject: [PATCH] Update nlohmann json to 3.7.3

---
 autobuild.xml                  | 32 --------------------------------
 indra/cmake/CMakeLists.txt     |  1 -
 indra/cmake/Json.cmake         |  6 ------
 indra/deps/CMakeLists.txt      | 16 +++++++++++++++-
 indra/llcommon/CMakeLists.txt  |  3 +--
 indra/llmessage/CMakeLists.txt |  4 ++--
 indra/newview/CMakeLists.txt   |  3 +--
 7 files changed, 19 insertions(+), 46 deletions(-)
 delete mode 100644 indra/cmake/Json.cmake

diff --git a/autobuild.xml b/autobuild.xml
index 034f6fe3ab..004eda9e5a 100644
--- a/autobuild.xml
+++ b/autobuild.xml
@@ -2090,38 +2090,6 @@
           </map>
         </map>
       </map>
-      <key>modernjson</key>
-      <map>
-        <key>copyright</key>
-        <string>Copyright (c) 2013-2019 Niels Lohmann</string>
-        <key>description</key>
-        <string>JSON for Modern C++</string>
-        <key>license</key>
-        <string>MIT</string>
-        <key>license_file</key>
-        <string>LICENSES/modernjson.txt</string>
-        <key>name</key>
-        <string>modernjson</string>
-        <key>platforms</key>
-        <map>
-          <key>common</key>
-          <map>
-            <key>archive</key>
-            <map>
-              <key>hash</key>
-              <string>fa2eb2ed28bb18730484ed5da29ac9d5</string>
-              <key>hash_algorithm</key>
-              <string>md5</string>
-              <key>url</key>
-              <string>https://pkg.alchemyviewer.org/repository/autobuild-external/modernjson/common/modernjson-3.7.0.192211123-common-192211123.tar.bz2</string>
-            </map>
-            <key>name</key>
-            <string>common</string>
-          </map>
-        </map>
-        <key>version</key>
-        <string>3.7.0.192211123</string>
-      </map>
       <key>ndPhysicsStub</key>
       <map>
         <key>copyright</key>
diff --git a/indra/cmake/CMakeLists.txt b/indra/cmake/CMakeLists.txt
index 0186e75f22..82d1911a7f 100644
--- a/indra/cmake/CMakeLists.txt
+++ b/indra/cmake/CMakeLists.txt
@@ -42,7 +42,6 @@ set(cmake_SOURCE_FILES
     Havok.cmake
     Hunspell.cmake
     JPEG.cmake
-    Json.cmake
     LLAddBuildTest.cmake
     LLAppearance.cmake
     LLAudio.cmake
diff --git a/indra/cmake/Json.cmake b/indra/cmake/Json.cmake
deleted file mode 100644
index 5c98370476..0000000000
--- a/indra/cmake/Json.cmake
+++ /dev/null
@@ -1,6 +0,0 @@
-# -*- cmake -*-
-
-include(Prebuilt)
-
-use_prebuilt_binary(modernjson)
-set(JSON_INCLUDE_DIR "${LIBS_PREBUILT_DIR}/include")
diff --git a/indra/deps/CMakeLists.txt b/indra/deps/CMakeLists.txt
index 20bf9e5781..764e3a733f 100644
--- a/indra/deps/CMakeLists.txt
+++ b/indra/deps/CMakeLists.txt
@@ -13,7 +13,12 @@ FetchContent_Declare(
 FetchContent_Declare(
   fmt
   GIT_REPOSITORY https://github.com/fmtlib/fmt.git
-  GIT_TAG        f94b7364b9409f05207c3af3fa4666730e11a854
+  GIT_TAG        6.1.2
+  )
+FetchContent_Declare(
+  nlohmann_json
+  GIT_REPOSITORY https://github.com/nlohmann/json.git
+  GIT_TAG        v3.7.3
   )
 FetchContent_Declare(
   absl
@@ -42,5 +47,14 @@ endif()
 #Download the rest of the libraries
 FetchContent_MakeAvailable(fmt)
 
+# Typically you don't care so much for a third party library's tests to be
+# run from your own project's code.
+set(JSON_BuildTests OFF CACHE INTERNAL "")
+
+# If you only include this third party in PRIVATE source files, you do not
+# need to install it when your main project gets installed.
+set(JSON_Install OFF CACHE INTERNAL "")
+FetchContent_MakeAvailable(nlohmann_json)
+
 unset(CMAKE_FOLDER)
 unset(CMAKE_POSITION_INDEPENDENT_CODE)
diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt
index 663bfb6354..011bb7f49c 100644
--- a/indra/llcommon/CMakeLists.txt
+++ b/indra/llcommon/CMakeLists.txt
@@ -13,7 +13,6 @@ include(Linking)
 include(Boost)
 include(OpenSSL)
 include(LLSharedLibs)
-include(Json)
 include(GooglePerfTools)
 include(Copy3rdPartyLibs)
 include(ZLIB)
@@ -24,7 +23,6 @@ include_directories(
     ${LLCOMMON_INCLUDE_DIRS}
     ${LLDARWIN_INCLUDE_DIRS}
     ${OPENSSL_INCLUDE_DIRS}
-    ${JSON_INCLUDE_DIR}
     ${ZLIB_INCLUDE_DIRS}
     ${BREAKPAD_INCLUDE_DIRECTORIES}
     ${URIPARSER_INCLUDE_DIRS}
@@ -312,6 +310,7 @@ target_link_libraries(
     absl::flat_hash_map
     absl::node_hash_map
     fmt::fmt
+    nlohmann_json::nlohmann_json
     ${RT_LIBRARY}
     )
 
diff --git a/indra/llmessage/CMakeLists.txt b/indra/llmessage/CMakeLists.txt
index cb3a51f338..e8aa8d0620 100644
--- a/indra/llmessage/CMakeLists.txt
+++ b/indra/llmessage/CMakeLists.txt
@@ -13,7 +13,6 @@ include(LLAddBuildTest)
 include(Python)
 include(Tut)
 include(Python)
-include(Json)
 include(NGHTTP2)
 
 include_directories (${CMAKE_CURRENT_SOURCE_DIR})
@@ -24,7 +23,6 @@ include_directories(
     ${LLMATH_INCLUDE_DIRS}
     ${LLMESSAGE_INCLUDE_DIRS}
     ${LLVFS_INCLUDE_DIRS}
-    ${JSON_INCLUDE_DIR}
     )
 
 include_directories(
@@ -218,6 +216,7 @@ endif(USE_PRECOMPILED_HEADERS)
 
 target_link_libraries(
   llmessage
+  PUBLIC
   ${LLCOREHTTP_LIBRARIES}
   ${LLVFS_LIBRARIES}
   ${LLMATH_LIBRARIES}
@@ -230,6 +229,7 @@ target_link_libraries(
   ${BOOST_COROUTINE_LIBRARY}
   ${BOOST_CONTEXT_LIBRARY}
   ${BOOST_SYSTEM_LIBRARY}
+  nlohmann_json::nlohmann_json
   ${RT_LIBRARY}
   ${PTHREAD_LIBRARY}
   )
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index db3f494106..721d1cf1cf 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -21,7 +21,6 @@ include(GLOD)
 include(GLEW)
 include(GooglePerfTools)
 include(Hunspell)
-include(Json)
 include(LLAppearance)
 include(LLDarwin)
 include(LLAudio)
@@ -80,7 +79,6 @@ endif(USE_CRASHPAD)
 include_directories(
     ${DBUSGLIB_INCLUDE_DIRS}
     ${ZLIB_INCLUDE_DIRS}
-    ${JSON_INCLUDE_DIR}
     ${GLOD_INCLUDE_DIR}
     ${LLDARWIN_INCLUDE_DIRS}
     ${LLAUDIO_INCLUDE_DIRS}
@@ -2042,6 +2040,7 @@ target_link_libraries(${VIEWER_BINARY_NAME}
     ${LLAPPEARANCE_LIBRARIES}
     absl::flat_hash_map
     absl::node_hash_map
+    nlohmann_json::nlohmann_json
     )
 
 set(ARTWORK_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE PATH
-- 
GitLab