curl-curl/scripts
Viktor Szakats 6dc5f2948c
cmake: improve clang-tidy invocation for tests in cross-builds
By passing to clang-tidy the C compiler with `--target` and sysroot
options, if any.

Fixing (GHA/windows, linux-mingw, CM clang-tidy):
```
lib/curl_setup.h:841:10: error: 'io.h' file not found [clang-diagnostic-error]
  841 | #include <io.h>
      |          ^~~~~~
Found compiler error(s).
FAILED: [code=1] tests/server/CMakeFiles/servers-clang-tidy bld/tests/server/CMakeFiles/servers-clang-tidy
cd tests/server && /usr/bin/clang-tidy --config-file=.clang-tidy.yml
--warnings-as-errors=* --checks=-clang-diagnostic-unused-function first.c getpart.c util.c dnsd.c [...]
-- <-D-options> <-I-options> <cflags>
```

For reference, this is CMake's built-in clang-tidy invocation:
```
/usr/local/bin/cmake -E __run_co_compile --tidy="/usr/bin/clang-tidy;--config-file=.clang-tidy.yml;
--warnings-as-errors=*;--extra-arg-before=--driver-mode=gcc" --source=lib/curl_fopen.c
-- /usr/bin/clang --target=x86_64-w64-mingw32 <-D-options> <-I-options> <cflags>
```

Also:
- bump cmakelint `--max-statements`. Needs 59 after this patch.
- use undocumented CMake variables:
  - `CMAKE_C_COMPILE_OPTIONS_TARGET` for `--target=`
  - `CMAKE_C_COMPILE_OPTIONS_SYSROOT` for `--sysroot=`

Cherry-picked from #20631

Closes #20640
2026-02-20 12:08:52 +01:00
..
.checksrc REUSE: move copyright headers to .checksrc 2025-10-13 11:54:22 +02:00
cd2cd tidy-up: miscellaneous 2026-02-12 14:52:16 +01:00
cd2nroff tidy-up: miscellaneous 2026-02-12 14:52:16 +01:00
cdall badwords: fix issues found in scripts and other files 2025-11-17 17:18:07 +01:00
checksrc-all.pl checksrc-all.pl: skip non-repository files 2026-01-26 16:07:58 +01:00
checksrc.pl tidy-up: miscellaneous 2026-02-12 14:52:16 +01:00
ciconfig.pl tidy-up: miscellaneous 2026-02-12 14:52:16 +01:00
cijobs.pl tidy-up: miscellaneous 2026-02-12 14:52:16 +01:00
cmakelint.sh cmake: improve clang-tidy invocation for tests in cross-builds 2026-02-20 12:08:52 +01:00
CMakeLists.txt cmake: replace deprecated PERL_FOUND with Perl_FOUND 2025-12-17 17:56:32 +01:00
completion.pl badwords: fix issues found in scripts and other files 2025-11-17 17:18:07 +01:00
contributors.sh tidy-up: miscellaneous 2026-01-15 13:06:13 +01:00
contrithanks.sh contrithanks.sh: adopt the stricter by: check from contributors.sh 2025-12-20 17:45:15 +01:00
coverage.sh GHA: add shellcheck job and fix warnings, shell tidy-ups 2024-04-08 09:37:24 +00:00
delta delta: fix grep patterns after white space edits 2025-12-30 14:04:10 +01:00
dmaketgz dmaketgz: use --no-cache when building docker image 2024-12-05 15:41:53 +01:00
extract-unit-protos scripts: enable strict warnings in Perl where missing, fix fallouts 2025-07-27 22:35:18 +02:00
firefox-db2pem.sh tidy-up: miscellaneous 2025-12-12 04:18:48 +01:00
installcheck.sh GHA: add shellcheck job and fix warnings, shell tidy-ups 2024-04-08 09:37:24 +00:00
Makefile.am build: add curl-lint/lint targets, CURL_LINT cmake option 2026-01-12 16:45:24 +01:00
maketgz scripts: use end-of-options marker in find -exec commands 2025-11-10 18:52:29 +01:00
managen tidy-up: miscellaneous 2026-02-12 14:52:16 +01:00
mdlinkcheck mdlinkcheck: only look for markdown links in markdown files 2025-12-11 23:40:07 +01:00
mk-ca-bundle.pl tidy-up: miscellaneous 2026-02-12 14:52:16 +01:00
mk-unity.pl cmake: replace the way clang-tidy verifies tests, fix issues found 2025-06-22 23:08:46 +02:00
nroff2cd scripts: enable strict warnings in Perl where missing, fix fallouts 2025-07-27 22:35:18 +02:00
perlcheck.sh cmake: match filename suffixes with file content 2025-12-20 11:34:27 +01:00
pythonlint.sh scripts: move the ruff linter command into a script 2025-05-13 16:41:32 -07:00
randdisable spelling: file system 2025-08-22 15:53:41 +02:00
release-notes.pl badwords: fix issues found in scripts and other files 2025-11-17 17:18:07 +01:00
release-tools.sh badwords: fix issues found in scripts and other files 2025-11-17 17:18:07 +01:00
schemetable.c lib: separate scheme info from protocol implementation 2026-01-19 23:15:13 +01:00
singleuse.pl tidy-up: merge root packages directory into projects 2026-01-12 23:49:35 +01:00
spacecheck.pl tidy-up: merge root packages directory into projects 2026-01-12 23:49:35 +01:00
top-complexity tidy-up: miscellaneous 2026-02-12 14:52:16 +01:00
verify-release verify-release: update to avoid shellcheck warning SC2034 2025-11-10 16:06:48 +01:00
wcurl wcurl: import v2026.01.05 2026-01-06 10:12:31 +01:00