Closed dominique120 closed 3 years ago
I recommend reading: https://pabloariasal.github.io/2018/02/19/its-time-to-do-cmake-right/
It's hard for me to predict the error. Try to replace:
include_directories(${Boost_INCLUDE_DIRS} ${MYSQL_INCLUDE_DIR} ${json_SOURCE_DIR})
by
target_include_directories(vts PRIVATE ${Boost_INCLUDE_DIRS})
target_include_directories(vts PRIVATE ${MYSQL_INCLUDE_DIR})
(I purposefully didn't added anything about ${json_SOURCE_DIR}, this is useless, and this might be the problem.
Its an interesting article thanks! However I solved the issue. There was nothing wrong with my cmake file. The issue was that I was using
#include <nlohmann\json.hpp>
instead of
#include <nlohmann/json.hpp>
and linux does not recognize backslashes as directory separators.
I'm trying to build an application with this library but either I'm making a mistake(most likely) or cmake fetch is not working.
I copied the code section exactly as it is in the readme and I can see that it downloads the repo, creates the files and headers but the compiler cant seem to find the header.
What could I be doing wrong?
Here is my cmake file as it is now:
I also tried downloading, building and installing the library manually and using
find_package(nlohmann_json 3.2.0 REQUIRED)
and it will find the package and begin compiling but it also failed to find the include files.Also tried adding /include after ${json_SOURCE_DIR}
CMake shows no errors, I'm on CentOS 8 and using GCC 8. Thanks!