← Commit list

1858126cca

Viktor Szakats
Viktor Szakats
2026-02-19
SUCCESS Duration: 327s

Subject

cmake: sync clang-tidy arg order in tests with C compiler

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+17 -17
@@ -103,6 +103,10 @@ endmacro()
# Internal: Recurse into target libraries and collect their include directories
# and macro definitions.
macro(curl_collect_target_options _target)
+ get_target_property(_val ${_target} COMPILE_DEFINITIONS)
+ if(_val)
+ list(APPEND _definitions ${_val})
+ endif()
get_target_property(_val ${_target} INTERFACE_INCLUDE_DIRECTORIES)
if(_val)
list(APPEND _includes ${_val})
@@ -111,10 +115,6 @@ macro(curl_collect_target_options _target)
if(_val)
list(APPEND _includes ${_val})
endif()
- get_target_property(_val ${_target} COMPILE_DEFINITIONS)
- if(_val)
- list(APPEND _definitions ${_val})
- endif()
get_target_property(_val ${_target} COMPILE_OPTIONS)
if(_val)
list(APPEND _options ${_val})
@@ -134,19 +134,19 @@ endmacro()
macro(curl_add_clang_tidy_test_target _target_clang_tidy _target)
if(CURL_CLANG_TIDY)
- set(_includes "")
set(_definitions "")
+ set(_includes "")
set(_options "")
- # Collect header directories and macro definitions applying to the directory
- get_directory_property(_val INCLUDE_DIRECTORIES)
- if(_val)
- list(APPEND _includes ${_val})
- endif()
+ # Collect macro definitions and header directories applying to the directory
get_directory_property(_val COMPILE_DEFINITIONS)
if(_val)
list(APPEND _definitions ${_val})
endif()
+ get_directory_property(_val INCLUDE_DIRECTORIES)
+ if(_val)
+ list(APPEND _includes ${_val})
+ endif()
get_directory_property(_val COMPILE_OPTIONS)
if(_val)
list(APPEND _options ${_val})
@@ -156,6 +156,11 @@ macro(curl_add_clang_tidy_test_target _target_clang_tidy _target)
# Collect header directories and macro definitions from lib dependencies
curl_collect_target_options(${_target})
+ list(REMOVE_ITEM _definitions "")
+ string(REPLACE ";" ";-D" _definitions ";${_definitions}")
+ list(REMOVE_DUPLICATES _definitions)
+ list(SORT _definitions) # Sort like CMake does
+
set(_includes_tmp ${_includes})
set(_includes)
foreach(_inc IN LISTS _includes_tmp)
@@ -167,11 +172,6 @@ macro(curl_add_clang_tidy_test_target _target_clang_tidy _target)
endforeach()
list(REMOVE_DUPLICATES _includes)
- list(REMOVE_ITEM _definitions "")
- string(REPLACE ";" ";-D" _definitions ";${_definitions}")
- list(REMOVE_DUPLICATES _definitions)
- list(SORT _definitions) # Sort like CMake does
-
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
list(REMOVE_DUPLICATES _options) # Keep the first of duplicates to imitate CMake
else()
@@ -192,12 +192,12 @@ macro(curl_add_clang_tidy_test_target _target_clang_tidy _target)
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
COMMAND ${CMAKE_C_CLANG_TIDY}
"--checks=-clang-diagnostic-unused-function"
- ${_sources} -- ${_includes} ${_definitions} ${_options}
+ ${_sources} -- ${_definitions} ${_includes} ${_options}
DEPENDS ${_sources})
add_dependencies(tests-clang-tidy ${_target_clang_tidy})
- unset(_includes)
unset(_definitions)
+ unset(_includes)
unset(_options)
unset(_sources)
endif()