cmake: improve clang-tidy test command-line reproduction

- also query `INTERFACE_COMPILE_DEFINITIONS` and
  `INTERFACE_COMPILE_OPTIONS`.
  To further sync clang-tidy manual command-lines with the C compiler
  command-lines generated by CMake. In practice this adds `-I` options
  (via `INTERFACE_COMPILE_OPTIONS`) to the end of the command-line for
  dependency header directories. It does not change the outcome of
  clang-tidy runs.

- limit querying `COMPILE_DEFINITIONS` and `COMPILE_OPTIONS` to the top
  target, the test itself. To not include options such as
  `-DCURL_HIDDEN_SYMBOLS` and `-fvisibility=hidden` (when set) via
  the libcurl shared lib.
  To sync with the actual C compiler command-line.

- drop redundant `unset()`.

- rename local function to be more specific.

Follow-up to d9386a2f8e #20759

Closes #20829
This commit is contained in:
Viktor Szakats 2026-03-06 01:51:30 +01:00
parent c6cfb2a2f3
commit 009facd232
No known key found for this signature in database
2 changed files with 22 additions and 13 deletions

View file

@ -72,8 +72,8 @@ cd "$(dirname "$0")"/..
--min-statement-spacing 1 \
--max-statement-spacing 2 \
--max-returns 6 \
--max-branches 15 \
--max-branches 20 \
--max-arguments 5 \
--max-localvars 15 \
--max-statements 85 \
--max-statements 95 \
--