cmake: replace cmakelint with cmake-lint from cmakelang, fix issues

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 #17576
This commit is contained in:
Viktor Szakats 2025-06-10 18:25:57 +02:00
parent 56d5982312
commit b761eb5add
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
12 changed files with 72 additions and 39 deletions

View file

@ -42,6 +42,7 @@ add_subdirectory(tunit)
add_subdirectory(unit)
add_subdirectory(certs)
# Add a runtests target with customized flags
function(curl_add_runtests _targetname _test_flags)
if(NOT BUILD_LIBCURL_DOCS)
string(APPEND _test_flags " !documentation")
@ -68,6 +69,7 @@ function(curl_add_runtests _targetname _test_flags)
)
endfunction()
# Add a pytests target with customized flags
function(curl_add_pytests _targetname _test_flags)
set(_depends "")
if(NOT _targetname STREQUAL "pytest-ci")

View file

@ -47,15 +47,15 @@ if(TEST_INTEGRATION_MODE STREQUAL "find_package" OR
TEST_INTEGRATION_MODE STREQUAL "ExternalProject")
find_package(CURL REQUIRED CONFIG)
find_package(CURL REQUIRED CONFIG) # Double-inclusion test
foreach(result_var IN ITEMS
foreach(_result_var IN ITEMS
CURL_FOUND
CURL_SUPPORTS_HTTPS
CURL_SUPPORTS_Largefile
CURL_VERSION
CURL_VERSION_STRING
)
if(NOT ${result_var})
message(FATAL_ERROR "'${result_var}' variable expected, but not set by the CURL package.")
)
if(NOT ${_result_var})
message(FATAL_ERROR "'${_result_var}' variable expected, but not set by the CURL package.")
endif()
endforeach()
# Show variables set by find_package()