构建时,cmake不包含子目录 [英] cmake does not include sub directory when building

查看:296
本文介绍了构建时,cmake不包含子目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用cmake来构建我的c ++项目。

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

我在src文件夹中有CmakeList.txt和main.cpp。

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

主要在src\log中包含LogStream.h。当我运行cmake时,我得到了错误。...

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"

我找了一段时间才找到一个本教程在cmake中包含一个子文件夹。我出于某种原因找不到简单的直接教程。

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.

推荐答案

使用 include_directories ,例如: include_directories(external / foo / include)

这篇关于构建时,cmake不包含子目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆