在CMake中,了解如何包含项目的头文件
In CMake how to include header files of the project
在C++项目中,我希望将头文件设置为项目源目录的子目录,而不使用UNIX目录快捷方式.
或..
。我不知道如何配置cmake来使用它。
我有目录结构:
Root
|-include
| |- foo.h
|-src
| | foo.cpp
放入root\CMakeList.txt:
project(root)
include_directories(${root_SOURCE_DIR}/include)
...
您可以在子项目中的任何位置使用root_SOURCE_DIR。
欲了解更多信息,请访问http://www.cmake.org/Wiki/CMake_Useful_Variables#Variables_not_listed_here
根文件夹中的CMakeLists.txt使用include_directories( include )
。或任何子文件夹中的include_directories( ${CMAKE_SOURCE_DIR}/include )
。
相关文章:
- 如何在 VSCODE 中设置项目文件夹并链接所有 CPP 文件
- 使用 Premake5 构建库,每个构建没有单独的项目文件
- CMake 如何强制third_party库将项目文件包含在当前项目源目录中?
- 当包含头文件的文件不在根项目文件夹中时,如何包含它
- Qt创建者:加载位于子目录中的项目文件
- 配置过程项目文件中的错误可能无效
- 哪些 Netbeans 8.2 项目文件应提交到C++项目的版本控制?
- C++错误LNK2005和不同项目文件的常规继承
- 为什么我的QTRPT项目文件未在QTCreator中运行
- 严重性代码说明项目文件行抑制状态错误 C2676 二进制">>":"std::ifstream"
- 如何在运行qmake时将变量传递到qmake项目文件
- 如何使用QPixmap,以便在地址中只需要使用项目文件夹
- CMake 插入不带文件夹前缀的项目文件
- QT无法解析项目文件
- 将静态库链接行添加到我的QT项目文件没有区别
- CMAKE QT创建者:将标题文件添加到项目文件中
- Qt C++:将所有库文件包含在项目文件夹中
- 对单元测试(googletest)和项目/文件夹/文件的混淆
- C++项目文件夹外部依赖项仅包含 .h 和 .hpp 文件
- 有没有办法将文件包含在C++中的所有项目文件中