Prevent infinite recursion (#15953)
This commit is contained in:
parent
c0ef9a862e
commit
15990afea2
@ -32,6 +32,8 @@ function(_ie_add_api_validator_post_build_step_recursive)
|
|||||||
NOT ${API_VALIDATOR_TARGET} IN_LIST API_VALIDATOR_TARGETS)
|
NOT ${API_VALIDATOR_TARGET} IN_LIST API_VALIDATOR_TARGETS)
|
||||||
list(APPEND API_VALIDATOR_TARGETS ${API_VALIDATOR_TARGET})
|
list(APPEND API_VALIDATOR_TARGETS ${API_VALIDATOR_TARGET})
|
||||||
endif()
|
endif()
|
||||||
|
# keep checks target list to track cyclic dependencies, leading to infinite recursion
|
||||||
|
list(APPEND checked_targets ${API_VALIDATOR_TARGET})
|
||||||
|
|
||||||
if(NOT LIBRARY_TYPE STREQUAL "INTERFACE_LIBRARY")
|
if(NOT LIBRARY_TYPE STREQUAL "INTERFACE_LIBRARY")
|
||||||
get_target_property(LINKED_LIBRARIES ${API_VALIDATOR_TARGET} LINK_LIBRARIES)
|
get_target_property(LINKED_LIBRARIES ${API_VALIDATOR_TARGET} LINK_LIBRARIES)
|
||||||
@ -43,6 +45,10 @@ function(_ie_add_api_validator_post_build_step_recursive)
|
|||||||
foreach(library IN LISTS LINKED_LIBRARIES INTERFACE_LINKED_LIBRARIES)
|
foreach(library IN LISTS LINKED_LIBRARIES INTERFACE_LINKED_LIBRARIES)
|
||||||
if(TARGET "${library}")
|
if(TARGET "${library}")
|
||||||
get_target_property(orig_library ${library} ALIASED_TARGET)
|
get_target_property(orig_library ${library} ALIASED_TARGET)
|
||||||
|
if(orig_library IN_LIST checked_targets OR library IN_LIST checked_targets)
|
||||||
|
# in case of cyclic dependencies, we need to skip current target
|
||||||
|
continue()
|
||||||
|
endif()
|
||||||
if(TARGET "${orig_library}")
|
if(TARGET "${orig_library}")
|
||||||
_ie_add_api_validator_post_build_step_recursive(TARGET ${orig_library})
|
_ie_add_api_validator_post_build_step_recursive(TARGET ${orig_library})
|
||||||
else()
|
else()
|
||||||
|
Loading…
Reference in New Issue
Block a user