From 040a099355b90968fca80f9290dea7dfa4f54390 Mon Sep 17 00:00:00 2001
From: Chuck Atkins <chuck.atkins@kitware.com>
Date: Tue, 27 Jun 2017 17:24:22 -0400
Subject: [PATCH] Fixup interface libraries for JSON and XML libs.

---
 thirdparty/NLohmannJson/CMakeLists.txt      |  5 +----
 thirdparty/NLohmannJson/json/CMakeLists.txt |  5 +++++
 thirdparty/pugixml/CMakeLists.txt           | 13 +------------
 thirdparty/pugixml/pugixml/CMakeLists.txt   | 10 ++++++++++
 4 files changed, 17 insertions(+), 16 deletions(-)
 create mode 100644 thirdparty/NLohmannJson/json/CMakeLists.txt
 create mode 100644 thirdparty/pugixml/pugixml/CMakeLists.txt

diff --git a/thirdparty/NLohmannJson/CMakeLists.txt b/thirdparty/NLohmannJson/CMakeLists.txt
index afe7c4a73..7a340d53d 100644
--- a/thirdparty/NLohmannJson/CMakeLists.txt
+++ b/thirdparty/NLohmannJson/CMakeLists.txt
@@ -1,4 +1 @@
-add_library(NLohmann::Json INTERFACE IMPORTED GLOBAL)
-set_target_properties(NLohmann::Json PROPERTIES
-  INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR}/json/src
-)
+add_subdirectory(json)
diff --git a/thirdparty/NLohmannJson/json/CMakeLists.txt b/thirdparty/NLohmannJson/json/CMakeLists.txt
new file mode 100644
index 000000000..9e34ce3a0
--- /dev/null
+++ b/thirdparty/NLohmannJson/json/CMakeLists.txt
@@ -0,0 +1,5 @@
+add_library(NLohmannJson INTERFACE)
+target_include_directories(NLohmannJson INTERFACE
+  $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
+)
+install(TARGETS NLohmannJson EXPORT adios2Exports)
diff --git a/thirdparty/pugixml/CMakeLists.txt b/thirdparty/pugixml/CMakeLists.txt
index 07a05515c..7cc8a3d59 100644
--- a/thirdparty/pugixml/CMakeLists.txt
+++ b/thirdparty/pugixml/CMakeLists.txt
@@ -1,12 +1 @@
-# This is an extremely simple and tiny library.  Rather than build it
-# seperately we'll just create an interface library containing the sources and
-# headers
-add_library(pugixml INTERFACE)
-target_sources(pugixml INTERFACE
-  ${CMAKE_CURRENT_SOURCE_DIR}/pugixml/src/pugiconfig.hpp
-  ${CMAKE_CURRENT_SOURCE_DIR}/pugixml/src/pugixml.hpp
-  ${CMAKE_CURRENT_SOURCE_DIR}/pugixml/src/pugixml.cpp
-)
-target_include_directories(pugixml INTERFACE
-  ${CMAKE_CURRENT_SOURCE_DIR}/pugixml/src
-)
+add_subdirectory(pugixml)
diff --git a/thirdparty/pugixml/pugixml/CMakeLists.txt b/thirdparty/pugixml/pugixml/CMakeLists.txt
new file mode 100644
index 000000000..0ff662a9e
--- /dev/null
+++ b/thirdparty/pugixml/pugixml/CMakeLists.txt
@@ -0,0 +1,10 @@
+add_library(pugixml INTERFACE)
+target_sources(pugixml INTERFACE
+  $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/pugiconfig.hpp>
+  $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/pugixml.hpp>
+  $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/pugixml.cpp>
+)
+target_include_directories(pugixml INTERFACE
+  $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
+)
+install(TARGETS pugixml EXPORT adios2Exports)
-- 
GitLab