find jsoncpp without pkgconfig

This commit is contained in:
Martin Brodbeck 2018-08-02 13:48:56 +02:00
parent ebe7035298
commit 876c8468df
2 changed files with 33 additions and 2 deletions

30
cmake/FindJSONCPP.cmake Normal file
View file

@ -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()

View file

@ -2,10 +2,11 @@ set(Boost_USE_STATIC_LIBS ON)
find_package(Boost 1.62 COMPONENTS date_time REQUIRED) find_package(Boost 1.62 COMPONENTS date_time REQUIRED)
find_package(SQLite3 REQUIRED) find_package(SQLite3 REQUIRED)
find_package(PkgConfig REQUIRED) #find_package(PkgConfig REQUIRED)
find_package(XLNT REQUIRED) find_package(XLNT REQUIRED)
find_package(JSONCPP REQUIRED)
#pkg_check_modules(XLNT REQUIRED xlnt>=1.3) #pkg_check_modules(XLNT REQUIRED xlnt>=1.3)
pkg_check_modules(JSONCPP REQUIRED jsoncpp) #pkg_check_modules(JSONCPP REQUIRED jsoncpp)
set(CORE_SOURCES set(CORE_SOURCES
database.cpp database.cpp