C++ CMake (add non-built files)(C++ CMake(添加非构建文件))
问题描述
我正在使用 cmake 来配置我的项目.我使用读取 CMakeLists.txt 的 qtcreator 可视化项目的文件.我有一些文本文件(非代码:配置文件、日志、..),我想将它们添加到我的 cmake 项目中,而无需(当然)编译/链接它们.是否可以 ?主要目标是使用 qtcreator 在我的项目树中自动打开它们并编辑它们......感谢您的帮助.
I am using cmake to configure my project. I visualize project's files using qtcreator which read the CMakeLists.txt. I have a few text files (non-code: config files, log, ..) and I would like to add them to my cmake project without (of course) compiling/linking them. Is it possible ? The main goal it to open them automatically in the tree of my project with qtcreator and edit them ... Thanks for help.
推荐答案
您应该能够在 add_executable
或 add_library
调用中将它们添加到您的源列表中是合适的,它们会出现在 IDE 中.
You should be able to just add them to your list of sources in whichever add_executable
or add_library
call is appropriate and they will appear in the IDE.
我相信 CMake 使用文件的扩展名来确定它们是否是实际的源文件,因此如果您的扩展名为.txt"或.log",它们将不会被编译.
I believe CMake uses the files' extensions to determine if they are actual source files, so if yours have extensions like ".txt" or ".log" they won't be compiled.
这篇关于C++ CMake(添加非构建文件)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:C++ CMake(添加非构建文件)


基础教程推荐
- 初始化列表*参数*评估顺序 2021-01-01
- 为什么派生模板类不能访问基模板类的标识符? 2021-01-01
- 为什么 RegOpenKeyEx() 在 Vista 64 位上返回错误代码 2021-01-01
- 如果我为无符号变量分配负值会发生什么? 2022-01-01
- 我应该对 C++ 中的成员变量和函数参数使用相同的名称吗? 2021-01-01
- CString 到 char* 2021-01-01
- GDB 显示调用堆栈上函数地址的当前编译二进制文 2022-09-05
- 通过引用传递 C++ 迭代器有什么问题? 2022-01-01
- 为什么 typeid.name() 使用 GCC 返回奇怪的字符以及如 2022-09-16
- 非静态 const 成员,不能使用默认赋值运算符 2022-10-09