build: tidy up compiler definition for tests#17768
Closed
vszakats wants to merge 17 commits intocurl:masterfrom
Closed
build: tidy up compiler definition for tests#17768vszakats wants to merge 17 commits intocurl:masterfrom
vszakats wants to merge 17 commits intocurl:masterfrom
Conversation
vszakats
added a commit
to vszakats/curl
that referenced
this pull request
Jun 28, 2025
Cherry-picked from curl#17768
vszakats
added a commit
to vszakats/curl
that referenced
this pull request
Jul 4, 2025
… option Current build doesn't hit this case, but a pending PR does. Fixing: ``` [...] -Ilib -Itests/client -DCURL_HIDDEN_SYMBOLS -DHAVE_CONFIG_H -D_definitions_t-NOTFOUND ``` error: ISO C99 requires whitespace after the macro name [clang-diagnostic-c99-extensions,-warnings-as-errors] Ref: curl#17768
This was referenced Jul 4, 2025
vszakats
added a commit
to vszakats/curl
that referenced
this pull request
Jul 4, 2025
Fix `curl_add_clang_tidy_test_target` generating an invalid option for `clang-tidy` if the tested target has no custom macro definition. Current build doesn't hit this case, but a pending PR does. Fixing: ``` [...] -Ilib -Itests/client -DCURL_HIDDEN_SYMBOLS -DHAVE_CONFIG_H -D_definitions_t-NOTFOUND ``` error: ISO C99 requires whitespace after the macro name [clang-diagnostic-c99-extensions,-warnings-as-errors] Cherry-picked from curl#17768 Closes curl#17813
vszakats
added a commit
to vszakats/curl
that referenced
this pull request
Jul 4, 2025
Factor out two local variables. Cherry-picked from curl#17768 Closes curl#17814
vszakats
added a commit
to vszakats/curl
that referenced
this pull request
Jul 4, 2025
Factor out two local variables. Cherry-picked from curl#17768 Closes curl#17814
vszakats
added a commit
to vszakats/curl
that referenced
this pull request
Jul 4, 2025
- simplify gathering header directories and compiler definitions recursively. - handle the case when the cmake directory doesn't define header directories or compiler definitions. - honor more corners cases: - `INTERFACE_INCLUDE_DIRECTORIES` of the initial target. - handle no header directory for initial target. - de-duplicate header directories and compiler redefinitions to mimic CMake. - drop unnecessary `unset()`s. Note that the order of header directories remains different compared to how CMake passes them to the compiler when building tests. The order is already skewed in the test target `INCLUDE_DIRECTORIES` property, preventing to reproduce the CMake order. The distinction between `-I` and `-isystem` is also missing from target properties. Cherry-picked from curl#17768 Closes curl#17814
vszakats
added a commit
to vszakats/curl
that referenced
this pull request
Jul 4, 2025
- simplify gathering header directories and compiler definitions recursively. - handle the case when the cmake directory doesn't define header directories or compiler definitions. - honor more corners cases: - `INTERFACE_INCLUDE_DIRECTORIES` of the initial target. - handle no header directory for initial target. - de-duplicate header directories and compiler redefinitions to mimic CMake. - drop unnecessary `unset()`s. Note that the order of header directories remains different compared to how CMake passes them to the compiler when building tests. The order is already skewed in the test target `INCLUDE_DIRECTORIES` property, preventing to reproduce the CMake order. The distinction between `-I` and `-isystem` is also missing from target properties. Cherry-picked from curl#17768 Closes curl#17814
vszakats
added a commit
that referenced
this pull request
Jul 4, 2025
- simplify gathering header directories and compiler definitions recursively. - handle the case when the cmake directory object doesn't define header directories or compiler definitions. - honor more corners cases: - `INTERFACE_INCLUDE_DIRECTORIES` of the initial target. - handle no header directory for initial target. - de-duplicate header directories and compiler redefinitions to mimic CMake. - drop unnecessary `unset()`s. Note that the order of header directories remains different compared to how CMake passes them to the compiler when building tests. The order is already different in the test target `INCLUDE_DIRECTORIES` property, preventing to reproduce the exact CMake order. The distinction between `-I` and `-isystem` is also missing from target properties. Cherry-picked from #17768 Closes #17814
To avoid generator expressions. Generator expresson do not work with curl_clang_tidy_tests() macro, resulting in an empty `-D` option and breaking clang-tidy: ``` error: macro name must be an identifier [clang-diagnostic-error] ``` https://github.com/curl/curl/actions/runs/15938223758/job/44962176793?pr=17768#step:14:337 But, curl/curl.h behaves the same on non-Windows with tests/server with and without CURL_STATICLIB, making it safe to pass for all platforms.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
target_compile_definitions().Makefile.amcomment with cmake.AM_CPPFLAGSlines to keep synced with cmake.first.hheaders from build level.CURL_NO_OLDIES,CURL_DISABLE_DEPRECATION,WITHOUT_LIBCURL,CURL_STATICLIB(for servers).To share more logic.
Pass
CURL_STATICLIBin server on all platforms for simplicity.(On non-Windows, it's a no-op. It's already done like this with curlu
and libcurltool.)
Also for lib:
Makefile.am).CURL_NO_OLDIES,CURL_DISABLE_DEPRECATIONon build level for better readability?
No, this seems fine on a second before/after review.