Skip to content

Usage of the jsoncpp CMake package #455

Closed
@ghisvail

Description

@ghisvail

Dear jsoncpp developers,

I tried to use the CMake package built by jsoncpp (and provided by libjsoncpp-dev on Debian / Ubuntu) on a CMake project depending on it.

I tried the following discovery via CMake config mode:

find_package(jsoncpp REQUIRED)
include_directories(${jsoncpp_INCLUDE_DIRS})
link_libraries(${jsoncpp_LIBRARIES})

But it does not seem to work. I then ran the the following test:

cmake_minimum_required(VERSION 2.6.2)
project(jsoncpp_test)

find_package(jsoncpp REQUIRED)
message("FOUND CONFIG: ${jsoncpp_CONFIG}")
message("INCLUDE DIRS: ${jsoncpp_INCLUDE_DIRS}")
message("LIBRARIES: ${jsoncpp_LIBRARIES}")

which produced the following output:

FOUND CONFIG: /usr/lib/x86_64-linux-gnu/cmake/jsoncpp/jsoncppConfig.cmake
INCLUDE DIRS: 
LIBRARIES: 

meaning the CMake package file is found but none of the expected variables is set.

How are we expected to discover and use jsoncpp under CMake then? FYI, using pkg-config works fine, but is not what I would consider a solution.

Many thanks,
Ghis

Metadata

Metadata

Assignees

No one assigned

    Labels

    build or testingcmake, meson, continuous integration, or testing relatedhelp wanted

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions