Skip to content

Building jsoncpp with cmake #922

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ParikaGoel opened this issue May 20, 2019 · 2 comments
Closed

Building jsoncpp with cmake #922

ParikaGoel opened this issue May 20, 2019 · 2 comments

Comments

@ParikaGoel
Copy link

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 ??

@ParikaGoel
Copy link
Author

Seems like jsoncppConfig.cmake file is not being generated by itself when I am building the library from sourcecode.

Is there a way this file could be made to generate by itself or should I add it manually ??

@baylesj
Copy link
Contributor

baylesj commented Jun 26, 2019

Fixed in #934

@baylesj baylesj closed this as completed Jun 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants