Browse Source

jsoncpp: Build the library within CMake

Update json/json.h to account for our lack of autolink.h.  Update
json/config.h to include KWSys Large File Support configuration so that
consistent stream libraries are used (on AIX with XL).

Add a cm_jsoncpp_reader.h header to include the CMake-provided copy of
the json/reader.h header from CMake sources.
Brad King 10 years ago
parent
commit
1fc556536e

+ 5 - 0
CMakeLists.txt

@@ -371,6 +371,11 @@ macro (CMAKE_BUILD_UTILITIES)
     CMAKE_SET_TARGET_FOLDER(cmexpat "Utilities/3rdParty")
   endif()
 
+  #---------------------------------------------------------------------
+  # Build jsoncpp library.
+  add_subdirectory(Utilities/cmjsoncpp)
+  CMAKE_SET_TARGET_FOLDER(cmjsoncpp "Utilities/3rdParty")
+
   #---------------------------------------------------------------------
   # Build XMLRPC library for CMake and CTest.
   if(CTEST_USE_XMLRPC)

+ 18 - 0
Utilities/cm_jsoncpp_reader.h

@@ -0,0 +1,18 @@
+/*============================================================================
+  CMake - Cross Platform Makefile Generator
+  Copyright 2000-2015 Kitware, Inc., Insight Software Consortium
+
+  Distributed under the OSI-approved BSD License (the "License");
+  see accompanying file Copyright.txt for details.
+
+  This software is distributed WITHOUT ANY WARRANTY; without even the
+  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+  See the License for more information.
+============================================================================*/
+#ifndef cm_jsoncpp_reader_h
+#define cm_jsoncpp_reader_h
+
+/* Use the jsoncpp library configured for CMake.  */
+#include <cmjsoncpp/include/json/reader.h>
+
+#endif

+ 17 - 0
Utilities/cmjsoncpp/CMakeLists.txt

@@ -0,0 +1,17 @@
+project(JsonCpp CXX)
+
+set(JSONCPP_SOURCES
+  src/lib_json/json_batchallocator.h
+  src/lib_json/json_reader.cpp
+  src/lib_json/json_tool.h
+  src/lib_json/json_value.cpp
+  src/lib_json/json_valueiterator.inl
+  src/lib_json/json_writer.cpp
+  )
+
+include_directories(
+  ${JsonCpp_SOURCE_DIR}/include
+  ${KWSYS_HEADER_ROOT}
+  )
+
+add_library(cmjsoncpp ${JSONCPP_SOURCES})

+ 3 - 0
Utilities/cmjsoncpp/include/json/config.h

@@ -6,6 +6,9 @@
 #ifndef JSON_CONFIG_H_INCLUDED
 #define JSON_CONFIG_H_INCLUDED
 
+// Include KWSys Large File Support configuration.
+#include <cmsys/Configure.h>
+
 /// If defined, indicates that json library is embedded in CppTL library.
 //# define JSON_IN_CPPTL 1
 

+ 0 - 1
Utilities/cmjsoncpp/include/json/json.h

@@ -6,7 +6,6 @@
 #ifndef JSON_JSON_H_INCLUDED
 #define JSON_JSON_H_INCLUDED
 
-#include "autolink.h"
 #include "value.h"
 #include "reader.h"
 #include "writer.h"