0

With cmake, we can put several targets in a user-defined folder within the Visual Studio project. For example:

enter image description here

This can be down with source_group command of cmake. So here is my question: how can I put a file within this folder. IN thisexample, how can I put readme.txt insider the modules folder, and make it parallel with targets such as opencv_core? Thanks.

feelfree
  • 11,175
  • 20
  • 96
  • 167
  • I've tried this in the past with CMake 2.8.12. You can't, it would have to be generated into your solution. Maybe newer versions of CMake does support it (haven't tried it). – Florian Jul 28 '16 at 14:53
  • Checked with the latest version, you can't. The code for this is just not there. You would need some code outputting `ProjectSection(SolutionItems) = preProject`|`EndProjectSection` sections in e.g. [`cmGlobalVisualStudio71Generator::WriteSLNFile()`](https://github.com/Kitware/CMake/blob/7d2a0aa76c25d92f1e2a03778f5666bdd7e56b92/Source/cmGlobalVisualStudio71Generator.cxx#L79) – Florian Aug 05 '16 at 13:40
  • "_Folders_" in Visual Studio solutions are called "_Filters_" and behave a little weird and entirely different compared to classic folders. The best you can do is using the mentioned `source_group` command in combination with the `FOLDER` property. – Torbjörn Aug 22 '16 at 06:00
  • Does this answer your question? [cmake: how to create visual studio filters](https://stackoverflow.com/questions/33808087/cmake-how-to-create-visual-studio-filters) – starball Sep 06 '22 at 05:53

0 Answers0