QtCreator CMake项目 - 如何显示所有项目文件 [英] QtCreator CMake project - how to show all project files

查看:3786
本文介绍了QtCreator CMake项目 - 如何显示所有项目文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用QtCreator打开CMake项目。除了CMakeLists.txt之外的一些目录仅包含头文件* .h,而对于那些目录,项目树视图中的QtCreator只显示CMakeLists.txt。如何解决这个问题?我需要从QtCreator中查看所有项目文件。

I use QtCreator to open CMake project. Some directories apart from CMakeLists.txt contains only headers files *.h and for those directories QtCreator in the project tree view shows only CMakeLists.txt. How to fix that ? I need to see all project files from QtCreator.

推荐答案

将项目视为文件系统不是一个解决方案,编辑器设置不适用。
我不喜欢添加头到可执行目标,因为他们实际上不属于那里。你有效地削减项目文件,以适合一个特定的IDE ...不好。
清除选项IMHO将是:

Viewing project as a file system is not a solution at all cause your project editor settings for example would not apply. And I do not like to add headers to executable target, cause they do not actually belong there. You effectively cripple the project file to work nicely with one particular IDE... not good. The cleaner option IMHO would be:

FILE(GLOB_RECURSE LibFiles "include/*.hpp")
add_custom_target(headers SOURCES ${LibFiles})

作为奖励,夹。
(借用自 https://cmake.org/pipermail/cmake/2012-August/051811 .html

这篇关于QtCreator CMake项目 - 如何显示所有项目文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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