cmake jsoncpp linking error
Hi, I have a feeling that jsoncpp library is incorrectly called in a CMakeLists.txt, resulting in a linking errors, the issue being that due to case sensitivity in pkg-config, it is incapable of finding Jsoncpp and linking Jsoncpp_lib.
To Reproduce Steps to reproduce the behavior:
- Clone the repository
- mkdir build && cd build && cmake .. && make
- See error
Expected behavior Code/drogon library links successfully against jsoncpp library
Environments tested
- jsoncpp and jsoncpp-devel installed via dnf
- jsoncpp compiled from source (checked out to 1.9.6) https://github.com/open-source-parsers/jsoncpp
OS version: Fedora 39, 6.5.6-300.fc39.x86_64 gcc (GCC) 13.3.1 20240913 (Red Hat 13.3.1-3) cmake version 3.30.5 pkg-config --version 1.9.5
Additional context For me, the fix was rewriting the CMakeLists.txt lines 190 and 191 using lowercase (to jsoncpp and jsoncpp_lib respectively). In case of meeting the same issue, modifying the cmakelists should do the trick, but feel free to ping me.
Installed jsoncpp and jsoncpp-devel
Build jsoncpp from source, did make install
Edited CMakeLists.txt in drogon root using lowercase from jsoncpp and lib
Still seeing bunch of undef refs to Json::
@cdeving They are a result of the fact, that Json Cpp builds against C++11, but the header auto-configures a feature that enables itself when C++17 (or newer) is used.
In my opinion, just revert commit https://github.com/open-source-parsers/jsoncpp/commit/60ccc1f5deb671e95d2a6cc761f6d03f3c8ade07 from jsoncpp. Or go into the installed header and remove the define for string view.
Or voice your concern here: https://github.com/open-source-parsers/jsoncpp/issues/1595