From 876c8468df8b38b1b55d2773b370b58c06ec8a61 Mon Sep 17 00:00:00 2001 From: Martin Brodbeck Date: Thu, 2 Aug 2018 13:48:56 +0200 Subject: [PATCH] find jsoncpp without pkgconfig --- cmake/FindJSONCPP.cmake | 30 ++++++++++++++++++++++++++++++ src/core/CMakeLists.txt | 5 +++-- 2 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 cmake/FindJSONCPP.cmake diff --git a/cmake/FindJSONCPP.cmake b/cmake/FindJSONCPP.cmake new file mode 100644 index 0000000..ef9ae7c --- /dev/null +++ b/cmake/FindJSONCPP.cmake @@ -0,0 +1,30 @@ +#ckwg +4 +# Copyright 2010 by Kitware, Inc. All Rights Reserved. Please refer to +# KITWARE_LICENSE.TXT for licensing information, or contact General Counsel, +# Kitware, Inc., 28 Corporate Drive, Clifton Park, NY 12065. + +# Locate the system installed JSONCPP +# The following variables will be set: +# +# JSONCPP_FOUND - Set to true if JSONCPP can be found +# JSONCPP_INCLUDE_DIR - The path to the JSONCPP header files +# JSONCPP_LIBRARY - The full path to the JSONCPP library + +if( JSONCPP_DIR ) + if( JSONCPP_FIND_VERSION ) + find_package( JSCONCPP ${JSONCPP_FIND_VERSION} NO_MODULE) + else() + find_package( JSONCPP NO_MODULE) + endif() +elseif( NOT JSONCPP_FOUND ) + message(STATUS "Searching for json.h") + find_path( JSONCPP_INCLUDE_DIR json ) + message(STATUS "Searching for json.h - ${JSONCPP_INCLUDE_DIR}") + + message(STATUS "Searching for libJSONCPP") + find_library( JSONCPP_LIBRARY jsoncpp ) + message(STATUS "Searching for libJSONCPP - ${JSCONPP_LIBRARY}") + + include( FindPackageHandleStandardArgs ) + FIND_PACKAGE_HANDLE_STANDARD_ARGS( JSONDPP JSONCPP_INCLUDE_DIR JSONCPP_LIBRARY ) +endif() diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 8708072..7a6b004 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -2,10 +2,11 @@ set(Boost_USE_STATIC_LIBS ON) find_package(Boost 1.62 COMPONENTS date_time REQUIRED) find_package(SQLite3 REQUIRED) -find_package(PkgConfig REQUIRED) +#find_package(PkgConfig REQUIRED) find_package(XLNT REQUIRED) +find_package(JSONCPP REQUIRED) #pkg_check_modules(XLNT REQUIRED xlnt>=1.3) -pkg_check_modules(JSONCPP REQUIRED jsoncpp) +#pkg_check_modules(JSONCPP REQUIRED jsoncpp) set(CORE_SOURCES database.cpp