include_directories不包含目录

时间:2018-03-22 15:59:36

标签: c++ compilation cmake

参考原始项目,因为它更容易解释。

我正在尝试编译这个项目: https://github.com/jbohg/render_kinect

我收到错误

/home/sarkar/libs/render_kinect/src/kinectSimulator.cpp:57:43: fatal 
error: render_kinect/kinectSimulator.h: No such file or directory
#include <render_kinect/kinectSimulator.h>
                                       ^

当包含目录中显示kinectSimulator.h时。并且

include_directories(${PROJECT_SOURCE_DIR}/include)

出现在cmake。

  • 我将#include <render_kinect/kinectSimulator.h>更改为#include "render_kinect/kinectSimulator.h"
  • 在cmake中添加include_directories(${PROJECT_SOURCE_DIR}/include/renderer_kinect),然后在源
  • 中添加#include "kinectSimulator.h"

似乎没什么用。看起来include_directories功能根本没有影响。虽然路径显示在

get_property(inc_dirs DIRECTORY PROPERTY INCLUDE_DIRECTORIES) 
message("inc_dirs = ${inc_dirs}") 

给出

inc_dirs = /home/sarkar/libs/render_kinect/include;other/include/paths

为什么这仍然不起作用?

修改 make verbose不显示-I选项。

make VERBOSE=1
/usr/bin/c++  <options>  -o CMakeFiles/RenderKinect.dir/src/kinectSimulator.o -c 
/home/sarkar/libs/render_kinect/src/kinectSimulator.cpp
/home/sarkar/libs/render_kinect/src/kinectSimulator.cpp:57:43: fatal 
error: render_kinect/kinectSimulator.h: No such file or directory

是否完全忽略了INCLUDE_DIRECTORIES属性?

0 个答案:

没有答案