【发布时间】:2020-11-01 22:36:10
【问题描述】:
我对 cmake 很陌生,但我在 Visual Studio 上使用它来开发一个必须在 linux 上运行的程序。我需要以这种方式包含以下内容:
#include <xscontroller/xscontrol_def.h>
#include <xscontroller/xsdevice_def.h>
#include <xscontroller/xsscanner.h>
#include <xstypes/xsoutputconfigurationarray.h>
#include <xstypes/xsdatapacket.h>
#include <xstypes/xstime.h>
#include <xscommon/xsens_mutex.h>
但是,只有当我执行以下操作时,Visual Studio 才能识别这些文件:
#include "xscontroller/xscontrol_def.h"
#include "xscontroller/xsdevice_def.h"
#include "xscontroller/xsscanner.h"
#include "xstypes/xsoutputconfigurationarray.h"
#include "xstypes/xsdatapacket.h"
#include "xstypes/xstime.h"
#include "xscommon/xsens_mutex.h"
我在 VS 中的项目结构相当简单:
ANT
-out
-xscommon
-xscontroller
-xstypes
-ANT.cpp
-CMakeLists.txt
.
.
.
我需要的包含在三个 xs 文件夹中,我相信它们必须在 Visual Studio 中以及将代码编译到 linux 上时都用 引用,因为每个标头中的引用都是以 形式完成的,这是导致此错误的原因:
xscallbackplainc.h:68:10: fatal error: xstypes/pstdint.h: No such file or directory
#include <xstypes/pstdint.h>
^~~~~~~~~~~~~~~~~~~
编译时。
简而言之,我真的只需要知道什么命令(无论是在 CMakeLists.txt 中还是在其他地方)将允许在项目中进行这种引用,并在 linux 上通过 ssh 编译项目。我知道#include "" 和#include <> 之间的区别,但是我对cmake 还是陌生的,并且到处找过,找不到答案。
【问题讨论】:
标签: c++ cmake directory cmakelists-options