xref: /Universal-ctags/docs/parser-cmake.rst (revision 7c39d0513b839637f39e023f2f1a009cb08b322e)
1.. _cmake:
2
3======================================================================
4CMake parser
5======================================================================
6
7The CMake parser is used for ``.cmake`` and ``CMakeLists.txt`` files.
8It generates tags for the following items:
9
10- User-defined functions
11- User-defined macros
12- User-defined options created by ``option()``
13- Variables defined by ``set()``
14- Targets created by ``add_custom_target()``, ``add_executable()`` and ``add_library()``
15
16The parser uses the experimental multi-table regex ``ctags`` options to
17perform the parsing and tag generation.
18
19Caveats:
20
21	Names that are ``${}`` references to variables are not tagged.
22
23	For example, given the following::
24
25	    set(PROJECT_NAME_STR ${PROJECT_NAME})
26	    add_executable( ${PROJECT_NAME_STR} ... )
27	    add_custom_target( ${PROJECT_NAME_STR}_tests ... )
28	    add_library( sharedlib ... )
29
30	...the variable ``PROJECT_NAME_STR`` and target ``sharedlib`` will both be tagged,
31	but the other targets will not be.
32
33
34References:
35
36	https://cmake.org/cmake/help/latest/manual/cmake-language.7.html
37