C ++ CMake(添加非构建文件) [英] C++ CMake (add non-built files)

查看:166
本文介绍了C ++ CMake(添加非构建文件)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用cmake来配置我的项目。我使用qtcreator可视化项目的文件,它读取CMakeLists.txt。
我有几个文本文件(非代码:配置文件,日志,..),我想把它们添加到我的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(添加非构建文件)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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