Skip to content

Commit 4ff0705

Browse files
committed
Update docs
1 parent b45311d commit 4ff0705

File tree

2 files changed

+54
-3
lines changed

2 files changed

+54
-3
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# PHP/AddCustomCommand
2+
3+
See: [AddCustomCommand.cmake](https://github.com/petk/php-build-system/tree/master/cmake/cmake/modules/PHP/AddCustomCommand.cmake)
4+
5+
Add custom command.
6+
7+
This module is built on top of the CMake
8+
[`add_custom_command`](https://cmake.org/cmake/help/latest/command/add_custom_command.html)
9+
and [`add_custom_target()`](https://cmake.org/cmake/help/latest/command/add_custom_target.html)
10+
commands.
11+
12+
A common issue in build systems is the generation of files with the project
13+
program itself. Here are two main cases:
14+
* PHP is found on the system: this is the most simple and developer-friendly to
15+
use as some files can be generated during the build phase.
16+
* When PHP is not found on the system, ideally the files could be generated
17+
after the PHP CLI binary is built in the current project itself. However, this
18+
can quickly bring cyclic dependencies between the target at hand, PHP CLI and
19+
the generated files. In such case, inconvenience is that two build steps might
20+
need to be done in order to generate the entire project once the file has been
21+
regenerated.
22+
23+
This module exposes the following function:
24+
25+
```cmake
26+
php_add_custom_command(
27+
<unique-symbolic-target-name>
28+
OUTPUT ...
29+
DEPENDS ...
30+
PHP_COMMAND ...
31+
[COMMENT <comment>]
32+
[VERBATIM]
33+
)
34+
```
35+
36+
It acts similar to `add_custom_command()` and `add_custom_target()`, except that
37+
the DEPENDS argument doesn't add dependencies among targets but instead checks
38+
their timestamps manually and executes the PHP_COMMAND only when needed.
39+
40+
```cmake
41+
php_add_custom_command(
42+
php_generate_something
43+
OUTPUTS
44+
list of generated files
45+
DEPENDS
46+
list of files or targets that this generation depends on
47+
PHP_COMMAND
48+
${CMAKE_CURRENT_SOURCE_DIR}/generate-something.php
49+
COMMENT "Generate something"
50+
VERBATIM
51+
)
52+
```

docs/evolution.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,9 +201,6 @@ including the removal of `aclocal.m4` in favor of the php related M4 macros in
201201
202202
* The hash extension is now always available, meaning the `--enable-hash`
203203
configure argument has been removed.
204-
* The filter extension no longer exposes the `--with-pcre-dir` configure
205-
argument and therefore allows shared builds with `./configure` for Unix
206-
builds.
207204
* Symbols `HAVE_DATE`, `HAVE_REFLECTION`, and `HAVE_SPL` have been removed. It
208205
should be considered to have these extensions always available.
209206
* Removed unused build time symbols: `PHP_ADA_INCLUDE`, `PHP_ADA_LFLAGS`,
@@ -233,6 +230,8 @@ including the removal of `aclocal.m4` in favor of the php related M4 macros in
233230
234231
##### Configure options
235232
233+
* The filter extension no longer exposes the `--with-pcre-dir` configure
234+
argument and therefore allows shared builds with `./configure`.
236235
* Added new `--enable-rtld-now` configure option to switch the dlopen behavior
237236
from `RTLD_LAZY` to `RTLD_NOW`.
238237
* The `--with-pcre-valgrind` and `--with-valgrind` were merged, and Valgrind

0 commit comments

Comments
 (0)