Skip to content

cmake: configure c-ares header directory in project root (was: lib) #17707

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

vszakats
Copy link
Member

The c-ares header directory was added to the header path within lib,
as opposed to every other dependency which added them in the root
CMakeLists.txt. Such exception is no longer necessary. This patch
aligns c-ares header setup with the rest of dependencies. And also with
autotools, which also makes no exception here.

Cherry-picked from #17705
Cherry-picked from #16973

Otherwise it only applies to lib targets via dir prop and this case
isn't picked up by the clang-tidy header dir picking logic. Also,
there was no real reason why this single header dir had to be specced
like this. Also referring to 16973 which also removed this exception.

To avoid this:
```
245/247] cd /Users/runner/work/curl/curl/tests/tunit && /opt/homebrew/opt/llvm/bin/clang-tidy -checks=-clang-analyzer-security.insecureAPI.strcpy,-clang-analyzer-security.insecureAPI.bzero,-clang-analyzer-optin.performance.Padding,-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling -quiet --warnings-as-errors=* ../libtest/first.c ../libtest/first.h tool1394.c tool1604.c tool1621.c -- -I/Users/runner/work/curl/curl/include -I/opt/homebrew/Cellar/mbedtls/3.6.3.1/include -I/opt/homebrew/Cellar/gnutls/3.8.9/include -I/opt/homebrew/Cellar/nettle/3.10.1/include -I/opt/homebrew/Cellar/libtasn1/4.20.0/include -I/opt/homebrew/Cellar/libidn2/2.3.8/include -I/opt/homebrew/Cellar/p11-kit/0.25.5/include/p11-kit-1 -I/opt/homebrew/Cellar/nettle/3.10.1/include -I/opt/homebrew/Cellar/brotli/1.1.0/include -I/opt/homebrew/opt/zstd/include -I/opt/homebrew/Cellar/libnghttp2/1.65.0/include -I/Applications/Xcode_15.4.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include -I/opt/homebrew/Cellar/libpsl/0.21.5_2/include -I/opt/homebrew/Cellar/libidn2/2.3.8/include -I/opt/homebrew/Cellar/libssh2/1.11.1/include -I/opt/homebrew/Cellar/openssl@3/3.5.0/include -I/opt/homebrew/Cellar/gsasl/2.2.2/include -I/opt/homebrew/Cellar/rtmpdump/2.4-20151223_3/include -I/opt/homebrew/Cellar/openssl@3/3.5.0/include -I/Users/runner/work/curl/curl/include -I/opt/homebrew/Cellar/mbedtls/3.6.3.1/include -I/opt/homebrew/Cellar/gnutls/3.8.9/include -I/opt/homebrew/Cellar/nettle/3.10.1/include -I/opt/homebrew/Cellar/libtasn1/4.20.0/include -I/opt/homebrew/Cellar/libidn2/2.3.8/include -I/opt/homebrew/Cellar/p11-kit/0.25.5/include/p11-kit-1 -I/opt/homebrew/Cellar/nettle/3.10.1/include -I/opt/homebrew/Cellar/brotli/1.1.0/include -I/opt/homebrew/opt/zstd/include -I/opt/homebrew/Cellar/libnghttp2/1.65.0/include -I/Applications/Xcode_15.4.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include -I/opt/homebrew/Cellar/libpsl/0.21.5_2/include -I/opt/homebrew/Cellar/libidn2/2.3.8/include -I/opt/homebrew/Cellar/libssh2/1.11.1/include -I/opt/homebrew/Cellar/openssl@3/3.5.0/include -I/opt/homebrew/Cellar/gsasl/2.2.2/include -I/opt/homebrew/Cellar/rtmpdump/2.4-20151223_3/include -I/opt/homebrew/Cellar/openssl@3/3.5.0/include -I/Users/runner/work/curl/curl/bld/lib -I/Users/runner/work/curl/curl/lib -I/Users/runner/work/curl/curl/lib/curlx -I/Users/runner/work/curl/curl/src -I/Users/runner/work/curl/curl/tests/libtest -I/Users/runner/work/curl/curl/tests/unit -I/Users/runner/work/curl/curl/tests/tunit -DHAVE_CONFIG_H -DUNITTESTS -DCURL_NO_OLDIES -DCURL_DISABLE_DEPRECATION
[1/5] Processing file /Users/runner/work/curl/curl/tests/tunit/../libtest/first.c.
192 warnings generated.
[2/5] Processing file /Users/runner/work/curl/curl/tests/tunit/../libtest/first.h.
384 warnings generated.
[3/5] Processing file /Users/runner/work/curl/curl/tests/tunit/tool1394.c.
576 warnings generated.
[4/5] Processing file /Users/runner/work/curl/curl/tests/tunit/tool1604.c.
768 warnings generated.
[5/5] Processing file /Users/runner/work/curl/curl/tests/tunit/tool1621.c.
960 warnings and 1 error generated.
Error while processing /Users/runner/work/curl/curl/tests/tunit/tool1621.c.
/Users/runner/work/curl/curl/lib/httpsrr.h:30:10: error: 'ares.h' file not found [clang-diagnostic-error]
   30 | #include <ares.h>
      |          ^~~~~~~~
FAILED: [code=1] tests/tunit/CMakeFiles/tunits-clang-tidy
```

https://github.com/curl/curl/actions/runs/15809101772/job/44557991572?pr=17705
@vszakats vszakats added cmake name lookup DNS and related tech tidy-up labels Jun 22, 2025
@github-actions github-actions bot added the build label Jun 22, 2025
@vszakats vszakats changed the title cmake: set c-ares header directory in root (was: lib) cmake: set c-ares header directory in project root (was: lib) Jun 22, 2025
@vszakats vszakats changed the title cmake: set c-ares header directory in project root (was: lib) cmake: configure c-ares header directory in project root (was: lib) Jun 22, 2025
@vszakats vszakats closed this in d1f036c Jun 22, 2025
@vszakats vszakats deleted the cm-ares-header-move-to-root branch June 22, 2025 19:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

1 participant