11#[=============================================================================[
22# PHP/Re2c
33
4- Generate lexer files with re2c.
4+ Finds the re2c command-line lexer generator and provides command to generate
5+ lexer files with re2c:
56
6- ## Functions
7+ ```cmake
8+ include(PHP/Re2c)
9+ ```
10+
11+ ## Commands
12+
13+ This module provides the following commands:
714
815### `php_re2c()`
916
10- Generate lexer file from the given template file using the re2c generator.
17+ Generates lexer file from the given template file using the re2c generator:
1118
1219```cmake
1320php_re2c(
@@ -25,8 +32,8 @@ php_re2c(
2532)
2633```
2734
28- This creates a target `<name>` and adds a command that generates lexer file
29- `<output>` from the given `<input>` template file using the re2c lexer
35+ This command creates a target `<name>` and adds a command that generates lexer
36+ file `<output>` from the given `<input>` template file using the re2c lexer
3037generator. Relative source file path `<input>` is interpreted as being relative
3138to the current source directory. Relative `<output>` file path is interpreted as
3239being relative to the current binary directory. If generated files are already
@@ -118,7 +125,7 @@ These variables can be set before using this module to configure behavior:
118125
119126## Examples
120127
121- ### Usage
128+ ### Example: Basic usage
122129
123130```cmake
124131# CMakeLists.txt
@@ -130,7 +137,7 @@ php_re2c(foo foo.re foo.c OPTIONS --bit-vectors --conditions)
130137# re2c --bit-vectors --conditions --output foo.c foo.re
131138```
132139
133- ### Specifying options
140+ ### Example: Specifying options
134141
135142This module provides some default options when using the `ADD_DEFAULT_OPTIONS`:
136143
@@ -142,7 +149,7 @@ php_re2c(foo foo.re foo.c ADD_DEFAULT_OPTIONS OPTIONS --conditions)
142149# re2c --no-debug-info --no-generation-date --conditions --output foo.c foo.re
143150```
144151
145- ### Generator expressions
152+ ### Example: Generator expressions
146153
147154```cmake
148155include(PHP/Re2c)
@@ -154,7 +161,7 @@ php_re2c(foo foo.re foo.c OPTIONS $<$<CONFIG:Debug>:--debug-output> -F)
154161# re2c -F --output foo.c foo.re
155162```
156163
157- ### Target usage
164+ ### Example: Target usage
158165
159166Target created by `php_re2c()` can be used to specify additional dependencies:
160167
@@ -173,7 +180,7 @@ Running only the `foo_lexer` target to generate the lexer-related files:
173180cmake --build <dir> --target foo_lexer
174181```
175182
176- ### Module configuration
183+ ### Example: Module configuration
177184
178185To specify different minimum required re2c version than the module's default,
179186the `find_package(RE2C)` can be called before `php_re2c()`:
0 commit comments