如何使用Cmake将通用头文件文件夹下的头子文件夹中的头文件分组
您好,我正在构建基于 Cmake 的构建系统。 我想将头文件分组到通用文件夹 Header Files 下的文件夹中(VC++ 可以做到)。 类似地,我想将相应的 .cpp
文件分组到 Source Files 目录下的文件夹中。 不幸的是我找不到任何关于如何操作的说明。
请帮忙。
迪米特雷
Hi I am building Cmake based build system.
I would like to group header files in folders (VC++ can do it) under the general folder Header Files.
Similar, I would like to group the corresponding .cpp
files in folders under the Source Files directory.
Unfortunately I could not find any instructions of how to do it.
Please help.
Dimitre
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您应该看看 CMake source_group 命令。
You should give a look at CMake source_group command.
您可以使用 source_group。这是一个具体的例子。
假设你有一个像这样的目录结构:
收集文件(有些人 - 包括文档 - 不鼓励使用 GLOB,但我把它留给你,如果你愿意,你可以列出它们之一,尽管我发现 GLOB 就可以了很多次):
You can use source_group. Here's a concrete example.
Suppose you have a directory structure like:
Collect the files (some people - including the documentation - discourages use of GLOB, but I leave that to you, you can list of them one by if you want to, though I find GLOB is just fine many times):