mirror of
https://github.com/curl/curl.git
synced 2026-04-15 00:21:42 +03:00
simplify
This commit is contained in:
parent
16b928233e
commit
3852c167a6
1 changed files with 24 additions and 35 deletions
|
|
@ -99,53 +99,50 @@ 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} INTERFACE_INCLUDE_DIRECTORIES)
|
||||
if(_val)
|
||||
list(APPEND _includes ${_val})
|
||||
endif()
|
||||
get_target_property(_val ${_target} INCLUDE_DIRECTORIES)
|
||||
if(_val)
|
||||
list(APPEND _includes ${_val})
|
||||
endif()
|
||||
get_target_property(_val ${_target} COMPILE_DEFINITIONS)
|
||||
if(_val)
|
||||
list(APPEND _definitions ${_val})
|
||||
endif()
|
||||
unset(_val)
|
||||
get_target_property(_libs ${_target} LINK_LIBRARIES)
|
||||
if(_libs)
|
||||
foreach(_lib IN LISTS _libs)
|
||||
if(TARGET "${_lib}")
|
||||
get_target_property(_val ${_lib} INTERFACE_INCLUDE_DIRECTORIES)
|
||||
if(_val)
|
||||
list(APPEND _includes ${_val})
|
||||
endif()
|
||||
get_target_property(_val ${_lib} INCLUDE_DIRECTORIES)
|
||||
if(_val)
|
||||
list(APPEND _includes ${_val})
|
||||
endif()
|
||||
get_target_property(_val ${_lib} COMPILE_DEFINITIONS)
|
||||
if(_val)
|
||||
list(APPEND _definitions ${_val})
|
||||
endif()
|
||||
curl_collect_target_options(${_lib})
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
unset(_libs)
|
||||
endmacro()
|
||||
|
||||
# Create a clang-tidy target for test targets
|
||||
macro(curl_add_clang_tidy_test_target _target_clang_tidy _target)
|
||||
if(CURL_CLANG_TIDY)
|
||||
|
||||
# Collect header directories and macro definitions applying to the directory
|
||||
get_directory_property(_includes INCLUDE_DIRECTORIES)
|
||||
if(NOT _includes)
|
||||
set(_includes "")
|
||||
endif()
|
||||
get_directory_property(_definitions COMPILE_DEFINITIONS)
|
||||
if(NOT _definitions)
|
||||
set(_definitions "")
|
||||
endif()
|
||||
|
||||
# Collect header directories and macro definitions from lib dependencies
|
||||
set(_includes "")
|
||||
set(_definitions "")
|
||||
curl_collect_target_options(${_target})
|
||||
|
||||
# Collect header directories applying to the target
|
||||
get_directory_property(_includes_d INCLUDE_DIRECTORIES)
|
||||
get_target_property(_includes_t ${_target} INCLUDE_DIRECTORIES)
|
||||
|
||||
set(_includes "${_includes};${_includes_d};${_includes_t}")
|
||||
list(REMOVE_ITEM _includes "")
|
||||
string(REPLACE ";" ";-I" _includes ";${_includes}")
|
||||
|
||||
# Collect macro definitions applying to the target
|
||||
get_directory_property(_definitions_d COMPILE_DEFINITIONS)
|
||||
get_target_property(_definitions_t ${_target} COMPILE_DEFINITIONS)
|
||||
if(NOT _definitions_t)
|
||||
unset(_definitions_t)
|
||||
endif()
|
||||
|
||||
set(_definitions "${_definitions};${_definitions_d};${_definitions_t}")
|
||||
list(REMOVE_ITEM _definitions "")
|
||||
string(REPLACE ";" ";-D" _definitions ";${_definitions}")
|
||||
list(SORT _definitions) # Sort like CMake does
|
||||
|
|
@ -165,16 +162,8 @@ macro(curl_add_clang_tidy_test_target _target_clang_tidy _target)
|
|||
DEPENDS ${_sources})
|
||||
add_dependencies(tests-clang-tidy ${_target_clang_tidy})
|
||||
|
||||
unset(_includes_d)
|
||||
unset(_includes_t)
|
||||
unset(_includes)
|
||||
unset(_definitions_d)
|
||||
unset(_definitions_t)
|
||||
unset(_definitions)
|
||||
unset(_sources)
|
||||
unset(_source)
|
||||
unset(_libs)
|
||||
unset(_lib)
|
||||
unset(_val)
|
||||
endif()
|
||||
endmacro()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue