如何在解决方案资源管理器上保留源文件夹层次 [英] How to keep source folders hierarchy on solution explorer?

查看:192
本文介绍了如何在解决方案资源管理器上保留源文件夹层次的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Linux上创建了一个C ++项目,我将许多目录中的源文件分组以组织自己。

I made a C++ project on Linux, and I grouped source files in many directories to organize myself.

我使用CMake编译,用一个CMakeFiles.txt每个子目录中。

I was using CMake to compile, with one CMakeFiles.txt on each subdirectory.

srcs
|--folderA
|  |--Toto.cpp
|  |--Tata.cpp
|
|--folderB
|  |--Foo.cpp
|  |--Bar.cpp
[...]

Visual Studio 2015找到每个源文件,但只是将整个列表放在解决方案资源管理器的源文件文件夹中。

Recently, I opened it with Visual Studio 2015, which found every source file, but just put the entire list on the "Source Files" folder of solution explorer.

Source Files
|--Toto.cpp
|--Tata.cpp
|--Foo.cpp
|--Bar.cpp

我计划有大量的文件,很快就很难找到。

I plan to have a huge number of files, and it shall be soon difficult to find one.

有没有办法明确告诉它尊重解决方案资源管理器上的文件夹层次结构?

Is there any way to explicitly tell it to respect the folder hierarchy on solution explorer?

推荐答案

source_group 命令。


source_group(< name> [FILES < src> ... ] [REGULAR_EXPRESSION < regex> ])

source_group(<name> [FILES <src>...] [REGULAR_EXPRESSION <regex>])

定义源将放置在项目文件中的组。这是为了在Visual Studio中设置文件选项卡。选项为:

Defines a group into which sources will be placed in project files. This is intended to set up file tabs in Visual Studio. The options are:

文件
任何明确指定的源文件将被放置在组中。相对路径将根据当前源目录进行解释。

FILES Any source file specified explicitly will be placed in group . Relative paths are interpreted with respect to the current source directory.

REGULAR_EXPRESSION
任何与正则表达式匹配的源文件都将放在组中。

REGULAR_EXPRESSION Any source file whose name matches the regular expression will be placed in group .

这篇关于如何在解决方案资源管理器上保留源文件夹层次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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