drogonframework / drogonframework/drogon
Compiling JsonCpp with Drogon in CMake
- Dominant language
- C++
- Stars
- 14.3k
- Forks
- 1.4k
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 14
Description
I am working on a project that uses Drogon as the server. I've been running it in my macbook with no problem, compiling everything with AppleClang. I now needed to run some tests by compiling it using gcc but I got some errors.
After searching I realised that the problem came from using the Homebrew version of jsoncpp (which is compiled using clang) instead of compiling it from source (as mentioned in issue #1288 )
Since I need to do this in CMake, as I want to be able to easily compile it in clang again (without having to change the installed version in my computer), I tried doing what was mentioned in issue #804 but it didn't work (most likely my CMake setup is wrong).
Can somehow guide me a bit? I am currently adding drogon to my project using this:
```
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
include(ExternalJsonCpp)
include(CPM)
CPMAddPackage(
NAME drogon
VERSION 1.8.4
GITHUB_REPOSITORY drogonframework/drogon
GIT_TAG v1.8.4
)
target_link_libraries(MyFinalProject drogon)
```
Inside the cmake folder there are 3 files, CPM.cmake (so I can use CPMAddPackage), FindJsoncpp.cmake (which just sets JsonCpp_FOUND) and ExternalJsonCpp.cmake.
The file ExternalJsonCpp.cmake was taken from [here](https://github.com/ethereum/cpp-dependencies/blob/master/jsoncpp.cmake). From what I can see it basically downloads jsoncpp and installs it, I guess I need to change something in this file to make it work.
When I try to run cmake, I get error "fatal error: json/json.h: No such file or directory" even tho ${JSONCPP_INCLUDE_DIR} and ${JSONCPP_LIBRARY} are properly set (I print them out inside the FindJsoncpp.cmake file)
Contributor guide
Assessment
This issue has not been assessed yet.