cmake does not include sub directory when building

2019-09-13 02:09发布

问题:

I am using cmake to build my c++ project.

I have my CmakeList.txt and my main.cpp in the src folder.

Main includes LogStream.h in src\log. When I run cmake and then make I get the error....

fatal error: LogStream.h: No such file or directory
 #include "LogStream.h"

I have looked for a while to find a tutorial to include a sub folder in cmake. I for some reason can not find a simple straight forward tutorial.

回答1:

Use include_directories, example: include_directories(external/foo/include)



标签: cmake