From 48c55c429ffaf7cd109d5ba0d20eb027e778cd31 Mon Sep 17 00:00:00 2001
From: acpaquette <acpaquette@usgs.gov>
Date: Mon, 5 Feb 2024 14:18:21 -0700
Subject: [PATCH] Fixed json headers being installed along side usgscsm (#474)

---
 CMakeLists.txt | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9a58556..02cc836 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -624,8 +624,12 @@ else()
   set(PROJ_INCLUDE_DIR /PROJ)
 
   # Nlohmann JSON
-  set(JSON_BuildTests OFF CACHE INTERNAL "")
-  add_subdirectory(json)
+  add_library (nlohmann_json INTERFACE)
+  add_library (nlohmann_json::nlohmann_json ALIAS nlohmann_json)
+  target_include_directories (nlohmann_json INTERFACE
+                              $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/json/include>
+                              $<INSTALL_INTERFACE:include>)
+  set(NLOHMANN_JSON_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/json/include)
 
   # ALE
   # Use Eigen included with ALE
@@ -663,6 +667,7 @@ else()
   target_link_libraries(ale PRIVATE ${ALE_LINKS})
   set(ALE_TARGET ale)
   set(USGSCSM_INCLUDE_DIRS "${USGSCSM_INCLUDE_DIRS}"
+                           "${NLOHMANN_JSON_INCLUDE_DIR}"
                            "${CMAKE_CURRENT_SOURCE_DIR}/ale/include"
                            "${CMAKE_CURRENT_SOURCE_DIR}/PROJ/include"
   )
-- 
GitLab