source_group.rst 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. source_group
  2. ------------
  3. Define a grouping for source files in IDE project generation.
  4. .. code-block:: cmake
  5. source_group(<name> [FILES <src>...] [REGULAR_EXPRESSION <regex>])
  6. Defines a group into which sources will be placed in project files.
  7. This is intended to set up file tabs in Visual Studio.
  8. The options are:
  9. ``FILES``
  10. Any source file specified explicitly will be placed in group
  11. ``<name>``. Relative paths are interpreted with respect to the
  12. current source directory.
  13. ``REGULAR_EXPRESSION``
  14. Any source file whose name matches the regular expression will
  15. be placed in group ``<name>``.
  16. If a source file matches multiple groups, the *last* group that
  17. explicitly lists the file with ``FILES`` will be favored, if any.
  18. If no group explicitly lists the file, the *last* group whose
  19. regular expression matches the file will be favored.
  20. The ``<name>`` of the group may contain backslashes to specify subgroups:
  21. .. code-block:: cmake
  22. source_group(outer\\inner ...)
  23. For backwards compatibility, the short-hand signature
  24. .. code-block:: cmake
  25. source_group(<name> <regex>)
  26. is equivalent to
  27. .. code-block:: cmake
  28. source_group(<name> REGULAR_EXPRESSION <regex>)