Skip to content

Building jsoncpp with cmake #922

Closed
Closed
@ParikaGoel

Description

@ParikaGoel

I am using jsoncpp library in my cmake project. So what I am trying to do is installing the jsoncpp library in my system and then in CMakeLists.txt, I add the instruction to find the package and use it. I am doing this following below steps :

cd /repo && wget -c https://github.com/open-source-parsers/jsoncpp/archive/1.8.4.zip &&
unzip 1.8.4.zip && cd /repo/jsoncpp-1.8.4 &&
mkdir build && cd build &&
cmake -DCMAKE_BUILD_TYPE=Release -DJSONCPP_WITH_TESTS=OFF -DJSONCPP_WITH_POST_BUILD_UNITTEST=OFF .. &&
make install

Then in my CMakeLists.txt, I add below two lines:
FIND_PACKAGE(jsoncpp REQUIRED)
TARGET_LINK_LIBRARIES(myProject jsoncpp)

But I am getting below error:

CMake Error at CMakeLists.txt:249 (FIND_PACKAGE):
By not providing "Findjsoncpp.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "jsoncpp", but
CMake did not find one.

Could not find a package configuration file provided by "jsoncpp" with any
of the following names:

jsoncppConfig.cmake
jsoncpp-config.cmake

Add the installation prefix of "jsoncpp" to CMAKE_PREFIX_PATH or set
"jsoncpp_DIR" to a directory containing one of the above files. If
"jsoncpp" provides a separate development package or SDK, be sure it has
been installed.

I don't know what am I missing ??

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions