-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
cmake: replace cmakelint
with cmake-lint
from cmakelang
, fix issues
#17576
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
Conversation
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
cmakelint
with cmake-lint
from cmakelang
, fix warnings
This comment was marked as outdated.
This comment was marked as outdated.
cmakelint
with cmake-lint
from cmakelang
, fix warningscmakelint
with cmake-lint
from cmakelang
, fix issues
vszakats
added a commit
that referenced
this pull request
Jun 11, 2025
Delete macros from `curl_config.h.cmake` that were never set by the CMake script: `_LARGE_FILES`, `_THREAD_SAFE`, `const`, `size_t`. Also: - lib/config-riscos.h: drop `#undef _LARGE_FILES`. This is an IBM-specific macro, no need to unset it on other platforms. Cherry-picked from #17576 Closes #17580
`` CMakeLists.txt:2034,35: [W0106] String looks like a variable reference missing an open tag '{PROJECT_SOURCE_DIR' CMakeLists.txt:2035,35: [W0106] String looks like a variable reference missing an open tag '{PROJECT_BINARY_DIR' ```
``` CMake/PickyWarnings.cmake:343,08: [C0103] Invalid directory variable name ""${_wlist}"" doesn't match `([A-Z][0-9A-Z_]+|[A-Z][A-Za-z0-9]+_FOUND|[a-z]+_SOURCES)|_[0-9a-z_]+` ```
The warning seems dubious, because `_GSS_VERSION` is defined by `pkg_search_module()`, but either I'm misunderstanding something, or cmake-lint is not recognizing this. ``` CMake/FindGSS.cmake:145,10: [C0103] Invalid directory variable name "_GSS_VERSION" doesn't match `([A-Z][0-9A-Z_]+|[A-Z][A-Za-z0-9]+_FOUND|[a-z]+_SOURCES)|_[0-9a-z_]+` CMake/FindGSS.cmake:273,10: [C0103] Invalid directory variable name "_GSS_VERSION" doesn't match `([A-Z][0-9A-Z_]+|[A-Z][A-Za-z0-9]+_FOUND|[a-z]+_SOURCES)|_[0-9a-z_]+` CMake/FindGSS.cmake:279,10: [C0103] Invalid directory variable name "_GSS_VERSION" doesn't match `([A-Z][0-9A-Z_]+|[A-Z][A-Za-z0-9]+_FOUND|[a-z]+_SOURCES)|_[0-9a-z_]+` CMake/FindGSS.cmake:285,10: [C0103] Invalid directory variable name "_GSS_VERSION" doesn't match `([A-Z][0-9A-Z_]+|[A-Z][A-Za-z0-9]+_FOUND|[a-z]+_SOURCES)|_[0-9a-z_]+` ```
This reverts commit ee0ecaa.
…ith naming rules fixup
Fixing: ``` docs/CMakeLists.txt:35,23: [C0113] Missing COMMENT in statement which allows it docs/CMakeLists.txt:41,22: [C0113] Missing COMMENT in statement which allows it docs/cmdline-opts/CMakeLists.txt:28,19: [C0113] Missing COMMENT in statement which allows it docs/cmdline-opts/CMakeLists.txt:36,18: [C0113] Missing COMMENT in statement which allows it docs/examples/CMakeLists.txt:25,18: [C0113] Missing COMMENT in statement which allows it docs/libcurl/CMakeLists.txt:43,25: [C0113] Missing COMMENT in statement which allows it docs/libcurl/CMakeLists.txt:67,19: [C0113] Missing COMMENT in statement which allows it docs/libcurl/CMakeLists.txt:79,18: [C0113] Missing COMMENT in statement which allows it docs/libcurl/opts/CMakeLists.txt:29,18: [C0113] Missing COMMENT in statement which allows it scripts/CMakeLists.txt:33,25: [C0113] Missing COMMENT in statement which allows it scripts/CMakeLists.txt:39,24: [C0113] Missing COMMENT in statement which allows it scripts/CMakeLists.txt:44,25: [C0113] Missing COMMENT in statement which allows it scripts/CMakeLists.txt:50,24: [C0113] Missing COMMENT in statement which allows it src/CMakeLists.txt:34,04: [C0113] Missing COMMENT in statement which allows it src/CMakeLists.txt:58,06: [C0113] Missing COMMENT in statement which allows it tests/CMakeLists.txt:32,18: [C0113] Missing COMMENT in statement which allows it tests/CMakeLists.txt:62,20: [C0113] Missing COMMENT in statement which allows it tests/CMakeLists.txt:79,20: [C0113] Missing COMMENT in statement which allows it tests/certs/CMakeLists.txt:28,19: [C0113] Missing COMMENT in statement which allows it tests/certs/CMakeLists.txt:33,18: [C0113] Missing COMMENT in statement which allows it tests/certs/CMakeLists.txt:36,18: [C0113] Missing COMMENT in statement which allows it tests/http/clients/CMakeLists.txt:25,18: [C0113] Missing COMMENT in statement which allows it tests/libtest/CMakeLists.txt:31,02: [C0113] Missing COMMENT in statement which allows it tests/libtest/CMakeLists.txt:40,04: [C0113] Missing COMMENT in statement which allows it tests/server/CMakeLists.txt:35,04: [C0113] Missing COMMENT in statement which allows it tests/tunit/CMakeLists.txt:31,04: [C0113] Missing COMMENT in statement which allows it tests/unit/CMakeLists.txt:31,04: [C0113] Missing COMMENT in statement which allows it ``` In most cases it seems to make little sense to add these. ``` # A custom command with one output doesn't really need a comment because # the default "generating XXX" is a good message already. ``` Also disabled in the tool itself: https://github.com/cheshirekow/cmake_format/blob/master/.cmake-format.py
Better this way because disable= directives apply to the whole file, not just the following line (or lines?)
It's a `#cmakedefine VAR ${VAR}` case where the two VARs must be the same string to work as expected.
Sadly this requires passing `--config-files` after the input files, which needs a xargs hack, which invokes the tool for each file, making it significantly slower.
denandz
pushed a commit
to denandz/curl
that referenced
this pull request
Jun 21, 2025
Delete macros from `curl_config.h.cmake` that were never set by the CMake script: `_LARGE_FILES`, `_THREAD_SAFE`, `const`, `size_t`. Also: - lib/config-riscos.h: drop `#undef _LARGE_FILES`. This is an IBM-specific macro, no need to unset it on other platforms. Cherry-picked from curl#17576 Closes curl#17580
denandz
pushed a commit
to denandz/curl
that referenced
this pull request
Jun 21, 2025
…sues This linter detects formatting and naming issues with minimal amount of noise. It seems to be an improvement over the existing linter which was only detecting line width overruns. Also: fix to exclude `CurlTests.c` from linter. Ref: https://cmake-format.readthedocs.io/en/latest/cmake-lint.html Ref: https://github.com/cheshirekow/cmake_format Closes curl#17576
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.
This linter detects formatting and naming issues with minimal amount of
noise. It seems to be an improvement over the existing linter which was
only detecting line width overruns.
Also: fix to exclude
CurlTests.c
from linter.Ref: https://cmake-format.readthedocs.io/en/latest/cmake-lint.html
Ref: https://github.com/cheshirekow/cmake_format
TODO:
.cmake-lint.yaml
to command-line options.I could not make work passing
-c <config>
to the tool.