From 7484874fdf799398523fc57022c3fd2cc85835f3 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Mon, 27 Jul 2026 02:42:09 +0200 Subject: [PATCH] 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 --- .github/workflows/checksrc.yml | 6 ++++-- docs/INSTALL-CMAKE.md | 1 + scripts/Makefile.am | 6 +++--- scripts/cmakeopts.sh | 33 +++++++++++++++++++++++++++++++++ 4 files changed, 41 insertions(+), 5 deletions(-) create mode 100755 scripts/cmakeopts.sh diff --git a/.github/workflows/checksrc.yml b/.github/workflows/checksrc.yml index 213aa94c2a..8baeac2887 100644 --- a/.github/workflows/checksrc.yml +++ b/.github/workflows/checksrc.yml @@ -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: | diff --git a/docs/INSTALL-CMAKE.md b/docs/INSTALL-CMAKE.md index 59b8c9ecac..d241efb007 100644 --- a/docs/INSTALL-CMAKE.md +++ b/docs/INSTALL-CMAKE.md @@ -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` diff --git a/scripts/Makefile.am b/scripts/Makefile.am index 7ffa98ed9b..6d0e92432d 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -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 diff --git a/scripts/cmakeopts.sh b/scripts/cmakeopts.sh new file mode 100755 index 0000000000..a58e086b4c --- /dev/null +++ b/scripts/cmakeopts.sh @@ -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}"