jansson icon indicating copy to clipboard operation
jansson copied to clipboard

"jansson_config.h" missing and cannot include the library in cmakelist

Open Nonesence999 opened this issue 2 years ago • 2 comments

In jansson.h:

fatal error: jansson_config.h: No such file or directory
   15 | #include "jansson_config.h"
      |          ^~~~~~~~~~~~~~~~~~

Issue whit cmake (I cannot include it) :

add_subdirectory(library/jansson)
target_link_libraries(PORJECT PRIVATE jansson)
#include <jansson.h> -> 'jansson.h' file not found
#include ../library/jansson/src/jansson.h -> working
#include ../cmake-build-debug/library/jansson/include/jansson.h -> working

Nonesence999 avatar Jun 25 '23 11:06 Nonesence999

I'm not an expert in CMake, but would #664 fix this issue, too?

akheron avatar Jul 09 '24 16:07 akheron

Yes, it would, because it will associate the headers with the target. When you write target_link_libraries(PROJECT PRIVATE jansson) the PUBLIC and INTERFACE dependencies of the jansson target will also become dependencies of the PROJECT target.

https://cmake.org/cmake/help/v3.1/command/target_link_libraries.html

JosiahWI avatar Jul 10 '24 01:07 JosiahWI