Skip to content

Commit 9888ee8

Browse files
committed
Update docs
1 parent 9fe2c9c commit 9888ee8

File tree

4 files changed

+41
-18
lines changed

4 files changed

+41
-18
lines changed

bin/make-docs.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#!/usr/bin/env php
22
<?php
33

4+
declare(strict_types=1);
5+
46
/**
57
* Generate documentation from the CMake project specific modules where needed.
68
*
@@ -25,7 +27,7 @@ function generateModuleDocs(
2527

2628
$content = '';
2729
$content .= "# $namespace" . "$moduleName\n\n";
28-
if ($url === '') {
30+
if ('' === $url) {
2931
$url = 'https://github.com/petk/php-build-system/tree/master/cmake/cmake/modules/' . $namespace . $moduleName . '.cmake';
3032
}
3133
$content .= "See: [$moduleName.cmake]($url)\n\n";
@@ -38,7 +40,7 @@ function generateModuleDocs(
3840

3941
file_put_contents(
4042
$destination . '/' . $namespace . $moduleName . '.md',
41-
$content
43+
$content,
4244
);
4345
}
4446
}
@@ -60,10 +62,10 @@ function generateModuleDocs(
6062

6163
foreach ($files as $file) {
6264
$relativeFilename = trim(str_replace($modulesDirectory, '', $file), '/');
63-
echo "Processing " . $relativeFilename . "\n";
65+
echo 'Processing ' . $relativeFilename . "\n";
6466

6567
$namespace = trim(str_replace($modulesDirectory, '', dirname($file)), '/');
66-
$namespace = ($namespace == '') ? '' : $namespace . '/';
68+
$namespace = ('' == $namespace) ? '' : $namespace . '/';
6769

6870
generateModuleDocs($file, $namespace, $docs);
6971
}

docs/cmake-code-style.md

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,12 @@ ecosystem.
3333
* [9.1. Determining processor](#91-determining-processor)
3434
* [10. See also](#10-see-also)
3535
* [10.1. Tools](#101-tools)
36-
* [10.1.1. cmake-format (by cmakelang project)](#1011-cmake-format-by-cmakelang-project)
37-
* [10.1.2. cmake-lint (by cmakelang project)](#1012-cmake-lint-by-cmakelang-project)
38-
* [10.1.3. cmakelint](#1013-cmakelint)
39-
* [10.1.4. bin/check-cmake.sh](#1014-bincheck-cmakesh)
40-
* [10.1.5. cmake-format.json](#1015-cmake-formatjson)
36+
* [10.1.1. Gersemi](#1011-gersemi)
37+
* [10.1.2. cmake-format (by cmakelang project)](#1012-cmake-format-by-cmakelang-project)
38+
* [10.1.3. cmake-lint (by cmakelang project)](#1013-cmake-lint-by-cmakelang-project)
39+
* [10.1.4. cmakelint](#1014-cmakelint)
40+
* [10.1.5. bin/check-cmake.php](#1015-bincheck-cmakephp)
41+
* [10.1.6. cmake-format.json](#1016-cmake-formatjson)
4142
* [10.2. Further resources](#102-further-resources)
4243

4344
## 1. Introduction
@@ -607,7 +608,16 @@ levels of maturity and a lack of updates to keep pace with new CMake versions.
607608
It's worth mentioning that this recommendation may evolve in the future as these
608609
tools continue to develop and adapt.
609610

610-
#### 10.1.1. cmake-format (by cmakelang project)
611+
#### 10.1.1. Gersemi
612+
613+
The [`gersemi`](https://github.com/BlankSpruce/gersemi) tool can check and fix
614+
CMake code style:
615+
616+
```sh
617+
gersemi --check --indent 2 --diff --definitions cmake -- cmake
618+
```
619+
620+
#### 10.1.2. cmake-format (by cmakelang project)
611621

612622
The [`cmake-format`](https://cmake-format.readthedocs.io/en/latest/) tool can
613623
find formatting issues and sync the CMake code style:
@@ -636,7 +646,7 @@ dumping the formatted content to stdout:
636646
cmake-format -i path/to/cmake/file
637647
```
638648

639-
#### 10.1.2. cmake-lint (by cmakelang project)
649+
#### 10.1.3. cmake-lint (by cmakelang project)
640650

641651
The [`cmake-lint`](https://cmake-format.readthedocs.io/en/latest/cmake-lint.html)
642652
tool is part of the cmakelang project and can help with linting CMake files:
@@ -648,7 +658,7 @@ cmake-lint <cmake/CMakeLists.txt cmake/...>
648658
This tool can also utilize the `cmake-format.[json|py|yaml]` file using the `-c`
649659
option.
650660

651-
#### 10.1.3. cmakelint
661+
#### 10.1.4. cmakelint
652662

653663
For linting there is also a separate and useful
654664
[cmakelint](https://github.com/cmake-lint/cmake-lint) tool which similarly lints
@@ -658,22 +668,22 @@ and helps to better structure CMake files:
658668
cmakelint <cmake/CMakeLists.txt cmake/...>
659669
```
660670

661-
#### 10.1.4. bin/check-cmake.sh
671+
#### 10.1.5. bin/check-cmake.php
662672

663673
For convenience there is a custom helper script added to this repository that
664674
checks CMake files:
665675

666676
```sh
667-
./bin/check-cmake.sh
677+
./bin/check-cmake.php cmake
668678
```
669679

670-
#### 10.1.5. cmake-format.json
680+
#### 10.1.6. cmake-format.json
671681

672682
The `cmake-format.json` file is used to configure how `cmake-lint` and
673683
`cmake-format` tools work.
674684

675685
There is `bin/cmake-format.json` added to this repository and is used by the
676-
custom `bin/check-cmake.sh` script. It includes only changed configuration
686+
custom `bin/check-cmake.php` script. It includes only changed configuration
677687
values from the upstream defaults.
678688

679689
* `disabled_codes`

docs/cmake-modules/PHP/AddCustomCommand.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@ php_add_custom_command(
3434
```
3535

3636
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.
37+
when PHP is not found on the system, the DEPENDS argument doesn't add
38+
dependencies among targets but instead checks their timestamps manually and
39+
executes the PHP_COMMAND only when needed.
3940

4041
```cmake
4142
php_add_custom_command(

docs/cmake-modules/PHP/Rebuild.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# PHP/Rebuild
2+
3+
See: [Rebuild.cmake](https://github.com/petk/php-build-system/tree/master/cmake/cmake/modules/PHP/Rebuild.cmake)
4+
5+
Rebuild all project targets.
6+
7+
When PHP is not found on the system, PHP generates some files during development
8+
using the php_cli target itself, which can bring cyclic dependencies among
9+
targets if custom commands would depend on the php_cli target. Although not a
10+
good practice, this helps bringing all targets to updated state.

0 commit comments

Comments
 (0)