cmake: verify if options are listed in INSTALL-CMAKE.md

Also:
- add one debug option to pass the test.

Ref: https://github.com/curl/curl/discussions/14885#discussioncomment-10632311

Closes #22404
This commit is contained in:
Viktor Szakats 2026-07-27 02:42:09 +02:00
parent f9dc57a149
commit 7484874fdf
No known key found for this signature in database
4 changed files with 41 additions and 5 deletions

View file

@ -84,9 +84,11 @@ jobs:
source ~/venv/bin/activate
scripts/cmakelint.sh
- name: 'cmake options in documentation'
run: scripts/cmakeopts.sh
- name: 'perlcheck'
run: |
scripts/perlcheck.sh
run: scripts/perlcheck.sh
- name: 'ruff'
run: |

View file

@ -203,6 +203,7 @@ target_link_libraries(my_target PRIVATE CURL::libcurl)
- `CURL_COMPLETION_FISH_DIR`: Custom fish completion install directory.
- `CURL_COMPLETION_ZSH`: Install zsh completions. Default: `OFF`
- `CURL_COMPLETION_ZSH_DIR`: Custom zsh completion install directory.
- `CURL_DEBUG_GLOBAL_MEM`: Debug `curl_global_init_mem`. Default: `OFF`
- `CURL_DEFAULT_SSL_BACKEND`: Override default TLS backend in MultiSSL builds.
Accepted values in order of default priority:
`wolfssl`, `gnutls`, `mbedtls`, `openssl`, `schannel`, `rustls`

View file

@ -25,9 +25,9 @@
EXTRA_DIST = coverage.sh completion.pl firefox-db2pem.sh checksrc.pl \
checksrc-all.pl mk-ca-bundle.pl mk-unity.pl schemetable.c cd2nroff nroff2cd \
cdall cd2cd managen dmaketgz maketgz release-tools.sh verify-release \
cmakelint.sh mdlinkcheck CMakeLists.txt perlcheck.sh pythonlint.sh \
spacecheck.pl randdisable wcurl top-complexity extract-unit-protos \
.checksrc badwords badwords-all badwords.txt top-length
cmakelint.sh cmakeopts.sh mdlinkcheck CMakeLists.txt perlcheck.sh \
pythonlint.sh spacecheck.pl randdisable wcurl top-complexity \
extract-unit-protos .checksrc badwords badwords-all badwords.txt top-length
dist_bin_SCRIPTS = wcurl

33
scripts/cmakeopts.sh Executable file
View file

@ -0,0 +1,33 @@
#!/usr/bin/env bash
# Copyright (C) Viktor Szakats
#
# SPDX-License-Identifier: curl
# Verify if CMake options are documented
set -eu
cd -- "$(dirname "$0")"/..
anyerr=0
while read -r opt; do
if ! grep -q -F -- "- \`$opt\`: " docs/INSTALL-CMAKE.md; then
echo "CMake option missing from documentation: '$opt'"
anyerr=1
fi
done < <(
{
git grep -o -E 'option\([A-Z][A-Z0-9_]+' ':!tests/cmake' |
grep -i cmake |
sed -E -e 's/^.+://g' -e 's/option\(//g'
git grep -h -o -E 'curl_dependency_option\([A-Z][A-Z0-9_]+' |
sed -e 's/curl_dependency_option(//g'
git grep -h -o -E "^# - \`[A-Z0-9_]+\`: " ':CMake/Find**' |
grep -o -E '[A-Z0-9_]+' |
grep -v -E '(_FOUND|_VERSION|NGTCP2_CRYPTO_BACKEND)'
} | sort -u
)
exit "${anyerr}"