Cdroid/cmake/modules/FindJSONCPP.cmake

30 lines
956 B
CMake
Executable File

find_package(PkgConfig)
pkg_check_modules(PC_JSONCPP zlib)
find_path(JSONCPP_INCLUDE_DIRS
NAMES zlib.h
HINTS ${PC_JSONCPP_INCLUDEDIR}
${PC_JSONCPP_INCLUDE_DIRS}
)
find_library(JSONCPP_LIBRARIES
NAMES jsoncpp
HINTS ${PC_JSONCPP_LIBDIR}
${PC_JSONCPP_LIBRARY_DIRS}
)
#message("JSONCPP_LIBRARIES=${JSONCPP_LIBRARIES} JSONCPP_INCLUDE_DIRS=${JSONCPP_INCLUDE_DIRS} PC_JSONCPP_VERSION=${PC_JSONCPP_VERSION}")
if(JSONCPP_INCLUDE_DIRS AND JSONCPP_LIBRARIES)
set(JSONCPP_FOUND TRUE)
set(JSONCPP_LIBRARY ${JSONCPP_LIBRARIES})
set(JSONCPP_INCLUDE_DIR ${JSONCPP_INCLUDE_DIRS})
set(JSONCPP_VERSION ${PC_JSONCPP_VERSION})
endif()
include(FindPackageHandleStandardArgs)
#FIND_PACKAGE_HANDLE_STANDARD_ARGS(zlib REQUIRED_VARS JSONCPP_INCLUDE_DIRS JSONCPP_LIBRARIES
# FOUND_VAR JSONCPP_FOUND VERSION_VAR JSONCPP_VERSION)
mark_as_advanced(JSONCPP_LIBRARIES JSONCPP_LIBRARY JSONCPP_INCLUDE_DIRS JSONCPP_INCLUDE_DIR JSONCPP_FOUND)