changeset 124:1267071a697e

dynamic jsoncpp in debian unstable
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 05 Oct 2012 15:23:20 +0200
parents 7350aff15193
children 2d96cb181f45 52c7eb60bbc8
files CMakeLists.txt Resources/CMake/JsonCppConfiguration.cmake
diffstat 2 files changed, 23 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/CMakeLists.txt	Fri Oct 05 10:19:52 2012 +0200
+++ b/CMakeLists.txt	Fri Oct 05 15:23:20 2012 +0200
@@ -11,6 +11,7 @@
 SET(ENABLE_SSL ON CACHE BOOL "Include support for SSL")
 SET(BUILD_UNIT_TESTS ON CACHE BOOL "Build the unit tests")
 SET(DEBIAN_HARDENING OFF CACHE BOOL "Use Debian hardening flags")
+SET(USE_DYNAMIC_JSONCPP OFF CACHE BOOL "Use the dynamic version of JsonCpp, only for Debian Unstable")
 
 if (${CMAKE_CROSSCOMPILING})
   SET(STANDALONE_BUILD ON)
--- a/Resources/CMake/JsonCppConfiguration.cmake	Fri Oct 05 10:19:52 2012 +0200
+++ b/Resources/CMake/JsonCppConfiguration.cmake	Fri Oct 05 15:23:20 2012 +0200
@@ -1,14 +1,25 @@
-SET(JSONCPP_SOURCES_DIR ${CMAKE_BINARY_DIR}/jsoncpp-src-0.5.0)
-DownloadPackage("http://downloads.sourceforge.net/project/jsoncpp/jsoncpp/0.5.0/jsoncpp-src-0.5.0.tar.gz" "${JSONCPP_SOURCES_DIR}" "" "")
+if (USE_DYNAMIC_JSONCPP)
+  CHECK_INCLUDE_FILE_CXX(jsoncpp/json/reader.h HAVE_JSONCPP_H)
+  if (NOT HAVE_JSONCPP_H)
+    message(FATAL_ERROR "Please install the libjsoncpp-dev package")
+  endif()
+
+  link_libraries(jsoncpp)
+
+else()
+  SET(JSONCPP_SOURCES_DIR ${CMAKE_BINARY_DIR}/jsoncpp-src-0.5.0)
+  DownloadPackage("http://downloads.sourceforge.net/project/jsoncpp/jsoncpp/0.5.0/jsoncpp-src-0.5.0.tar.gz" "${JSONCPP_SOURCES_DIR}" "" "")
 
-list(APPEND THIRD_PARTY_SOURCES
-  ${JSONCPP_SOURCES_DIR}/src/lib_json/json_reader.cpp
-  ${JSONCPP_SOURCES_DIR}/src/lib_json/json_value.cpp
-  ${JSONCPP_SOURCES_DIR}/src/lib_json/json_writer.cpp
-  )
+  list(APPEND THIRD_PARTY_SOURCES
+    ${JSONCPP_SOURCES_DIR}/src/lib_json/json_reader.cpp
+    ${JSONCPP_SOURCES_DIR}/src/lib_json/json_value.cpp
+    ${JSONCPP_SOURCES_DIR}/src/lib_json/json_writer.cpp
+    )
 
-include_directories(
-  ${JSONCPP_SOURCES_DIR}/include
-  )
+  include_directories(
+    ${JSONCPP_SOURCES_DIR}/include
+    )
 
-source_group(ThirdParty\\JsonCpp REGULAR_EXPRESSION ${JSONCPP_SOURCES_DIR}/.*)
+  source_group(ThirdParty\\JsonCpp REGULAR_EXPRESSION ${JSONCPP_SOURCES_DIR}/.*)
+endif()
+