← Commit list

6dc5f2948c

Viktor Szakats
Viktor Szakats
2026-02-20
SUCCESS Duration: 347s

Subject

cmake: improve clang-tidy invocation for tests in cross-builds

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

CMake/Macros.cmake+12 -1
@@ -187,15 +187,26 @@ macro(curl_add_clang_tidy_test_target _target_clang_tidy _target)
list(APPEND _sources "${_source}")
endforeach()
+ set(_cc "${CMAKE_C_COMPILER}")
+ if(CMAKE_C_COMPILER_TARGET AND CMAKE_C_COMPILE_OPTIONS_TARGET)
+ list(APPEND _cc "${CMAKE_C_COMPILE_OPTIONS_TARGET}${CMAKE_C_COMPILER_TARGET}")
+ endif()
+ if(APPLE AND CMAKE_OSX_SYSROOT)
+ list(APPEND _cc "-isysroot" "${CMAKE_OSX_SYSROOT}")
+ elseif(CMAKE_SYSROOT AND CMAKE_C_COMPILE_OPTIONS_SYSROOT)
+ list(APPEND _cc "${CMAKE_C_COMPILE_OPTIONS_SYSROOT}${CMAKE_SYSROOT}")
+ endif()
+
# Pass -clang-diagnostic-unused-function to disable -Wunused-function implied by -Wunused
add_custom_target(${_target_clang_tidy} USES_TERMINAL
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
COMMAND ${CMAKE_C_CLANG_TIDY}
"--checks=-clang-diagnostic-unused-function"
- ${_sources} -- ${_definitions} ${_includes} ${_options}
+ ${_sources} -- ${_cc} ${_definitions} ${_includes} ${_options}
DEPENDS ${_sources})
add_dependencies(tests-clang-tidy ${_target_clang_tidy})
+ unset(_cc)
unset(_definitions)
unset(_includes)
unset(_options)
scripts/cmakelint.sh+1 -1
@@ -75,5 +75,5 @@ cd "$(dirname "$0")"/..
--max-branches 12 \
--max-arguments 5 \
--max-localvars 15 \
- --max-statements 50 \
+ --max-statements 65 \
--