-
Notifications
You must be signed in to change notification settings - Fork 2.7k
How to link jsoncpp library in cmake project #927
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
Comments
jsoncppConfig.cmake
defines property INTERFACE_INCLUDE_DIRECTORIES
for targets jsoncpp_lib
and jsoncpp_lib_static
.
Above solution was already posted to include the jsoncpp library in cmake projects. But this solution requires jsoncppConfig.cmake file which is available if I install default jsoncpp package provided by ubuntu. I am compiling the jsoncpp code from source. How could I link it into my cmake project if I am compiling it from source. I also don't want to use pkgconfig to search for jsoncpp |
the jsoncppConfig.cmake is built and installed when the CMake option So configure build with cmake (some and for your consuming project, call CMake with CMAKE_PREFIX_PATH set to the root of the folder where you installed jsoncpp, and link your library/executable against jsoncpp_lib ( This should do the trick, if I don't misunderstand your question. |
Fixed by #934 ... thanks @oleurodecision!!! |
Is it possible to make meson output the |
As far as I know, it can't.
You can still use cmake to build the jsoncpp, and then link it in another library. |
@clouds56 Do you need the |
A common convention for CMake target name is using an alias target. I expected to jsoncpp target name for linking was |
Please file a PR. We use (and strongly recommend) meson instead of cmake. We rely on users for most cmake updates. |
The
jsoncppConfig.cmake
defines propertyINTERFACE_INCLUDE_DIRECTORIES
for targetsjsoncpp_lib
andjsoncpp_lib_static
.You need to query the target property and set it manually:
Linking is done via:
Originally posted by @christian-rauch in #455 (comment)
The text was updated successfully, but these errors were encountered: