# available ressources for CMake's syntax description?

**URL:** https://discourse.cmake.org/t/available-ressources-for-cmakes-syntax-description/4105
**Category:** Community
**Created:** [September 17, 2021, 8:25am UTC](https://discourse.cmake.org/t/available-ressources-for-cmakes-syntax-description/4105 "2021-09-17T08:25:54Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![hex](https://discourse.cmake.org/user_avatar/discourse.cmake.org/hex/32/363_2.png) [@hex](https://discourse.cmake.org/u/hex)
#### Post date: [September 17, 2021, 8:25am UTC](https://discourse.cmake.org/t/available-ressources-for-cmakes-syntax-description/4105/1 "2021-09-17T08:25:54Z")

</div>

does anyone know of a complete syntax description for CMake? I’m planning to create more accurate syntax highlighting for Sublime Text.

The [CMake documentation](https://cmake.org/cmake/help/v3.0/manual/cmake-language.7.html) is of course a good starting point.

---

<div class="post-metadata">

### Author: ![erk](https://discourse.cmake.org/user_avatar/discourse.cmake.org/erk/32/114_2.png) [@erk](https://discourse.cmake.org/u/erk)
#### Post date: [September 17, 2021, 8:41am UTC](https://discourse.cmake.org/t/available-ressources-for-cmakes-syntax-description/4105/2 "2021-09-17T08:41:16Z")

</div>

AFAIK the syntax is described in various Lex files:

> **[CMake/Source/LexerParser at master · Kitware/CMake](https://github.com/Kitware/CMake/tree/master/Source/LexerParser)**
>
> master/Source/LexerParser

for list file there is:

> <https://github.com/Kitware/CMake/blob/master/Source/LexerParser/cmListFileLexer.in.l>

and some other for expression and command arguments.  
Not sure this is the best readable way to get CMake syntax.

There is the cmake-format code too:

> **[GitHub - cheshirekow/cmake\_format: Source code formatter for cmake listfiles.](https://github.com/cheshirekow/cmake_format)**
>
> Source code formatter for cmake listfiles. Contribute to cheshirekow/cmake\_format development by creating an account on GitHub.

where some lexer may be found:  
[cmake\_format/cmakelang/lex at master · cheshirekow/cmake\_format · GitHub](https://github.com/cheshirekow/cmake_format/blob/master/cmakelang/lex/) **init**.py  
Don’t know how it is keep in sync with CMake upstream though.

---

<div class="post-metadata">

### Author: ![craig.scott](https://discourse.cmake.org/user_avatar/discourse.cmake.org/craig.scott/32/20_2.png) [@craig.scott](https://discourse.cmake.org/u/craig.scott)
#### Post date: [September 18, 2021, 10:03pm UTC](https://discourse.cmake.org/t/available-ressources-for-cmakes-syntax-description/4105/3 "2021-09-18T22:03:52Z")

</div>

[https://cmake.org/cmake/help/latest/manual/cmake-language.7.html](https://cmake.org/cmake/help/latest/manual/cmake-language.7.html) contains the formal language description, if that’s what you’re looking for.
