CMake can not find include files

There were two problems. Firstly you have to add the jsoncpp/json path to your included directories. However, doing so creates a second problem. Since your executables are not in the source folder you needed to prefix ${CMAKE_SOURCE_DIR} to your paths so include_directories() would look like following:

include_directories("${CMAKE_SOURCE_DIR}/jsoncpp"
    "${CMAKE_SOURCE_DIR}/jsoncpp/json"
    "${CMAKE_SOURCE_DIR}/jsonreader")

I've added quotes just out of habit. I do this most of the time with my CMakeLists.txt so there are no problems with spaces in paths.


Amani,

It seems as if you include "json.h" without its relative path. You can either include it like this:

#include "json/json.h"

OR, in your CMakeLists.txt file, add the json directory to the include directories:

include_directories(jsoncpp jsoncpp/json jsonreader)