|
15 | 15 | function(get_object_files_for_test result skipped_entrypoints_list)
|
16 | 16 | set(object_files "")
|
17 | 17 | set(skipped_list "")
|
18 |
| - foreach(dep IN LISTS ARGN) |
19 |
| - if (NOT TARGET ${dep}) |
20 |
| - # Skip any tests whose dependencies have not been defined. |
21 |
| - list(APPEND skipped_list ${dep}) |
22 |
| - continue() |
23 |
| - endif() |
24 |
| - get_target_property(dep_type ${dep} "TARGET_TYPE") |
25 |
| - if(NOT dep_type) |
26 |
| - # Target for which TARGET_TYPE property is not set do not |
27 |
| - # provide any object files. |
28 |
| - continue() |
29 |
| - endif() |
| 18 | + set(checked_list "") |
| 19 | + set(unchecked_list "${ARGN}") |
| 20 | + list(REMOVE_DUPLICATES unchecked_list) |
| 21 | + list(LENGTH unchecked_list length) |
30 | 22 |
|
31 |
| - if(${dep_type} STREQUAL ${OBJECT_LIBRARY_TARGET_TYPE}) |
32 |
| - get_target_property(dep_object_files ${dep} "OBJECT_FILES") |
33 |
| - if(dep_object_files) |
34 |
| - list(APPEND object_files ${dep_object_files}) |
35 |
| - endif() |
36 |
| - elseif(${dep_type} STREQUAL ${ENTRYPOINT_OBJ_TARGET_TYPE}) |
37 |
| - get_target_property(is_skipped ${dep} "SKIPPED") |
38 |
| - if(is_skipped) |
| 23 | + while(length) |
| 24 | + set(indirect_list "") |
| 25 | + |
| 26 | + foreach(dep IN LISTS unchecked_list) |
| 27 | + if (NOT TARGET ${dep}) |
| 28 | + # Skip tests with undefined dependencies. |
39 | 29 | list(APPEND skipped_list ${dep})
|
40 | 30 | continue()
|
41 | 31 | endif()
|
42 |
| - get_target_property(object_file_raw ${dep} "OBJECT_FILE_RAW") |
43 |
| - if(object_file_raw) |
44 |
| - list(APPEND object_files ${object_file_raw}) |
| 32 | + get_target_property(dep_type ${dep} "TARGET_TYPE") |
| 33 | + if(NOT dep_type) |
| 34 | + # Skip tests with no object dependencies. |
| 35 | + continue() |
45 | 36 | endif()
|
46 |
| - elseif(${dep_type} STREQUAL ${ENTRYPOINT_OBJ_VENDOR_TARGET_TYPE}) |
47 |
| - # We skip tests for all externally implemented entrypoints. |
48 |
| - list(APPEND skipped_list ${dep}) |
49 |
| - continue() |
50 |
| - endif() |
51 | 37 |
|
52 |
| - get_target_property(indirect_deps ${dep} "DEPS") |
53 |
| - get_object_files_for_test( |
54 |
| - indirect_objfiles indirect_skipped_list ${indirect_deps}) |
55 |
| - list(APPEND object_files ${indirect_objfiles}) |
56 |
| - if(indirect_skipped_list) |
57 |
| - list(APPEND skipped_list ${indirect_skipped_list}) |
58 |
| - endif() |
59 |
| - endforeach(dep) |
| 38 | + if(${dep_type} STREQUAL ${OBJECT_LIBRARY_TARGET_TYPE}) |
| 39 | + get_target_property(dep_object_files ${dep} "OBJECT_FILES") |
| 40 | + if(dep_object_files) |
| 41 | + list(APPEND object_files ${dep_object_files}) |
| 42 | + endif() |
| 43 | + elseif(${dep_type} STREQUAL ${ENTRYPOINT_OBJ_TARGET_TYPE}) |
| 44 | + get_target_property(is_skipped ${dep} "SKIPPED") |
| 45 | + if(is_skipped) |
| 46 | + list(APPEND skipped_list ${dep}) |
| 47 | + continue() |
| 48 | + endif() |
| 49 | + get_target_property(object_file_raw ${dep} "OBJECT_FILE_RAW") |
| 50 | + if(object_file_raw) |
| 51 | + list(APPEND object_files ${object_file_raw}) |
| 52 | + endif() |
| 53 | + elseif(${dep_type} STREQUAL ${ENTRYPOINT_OBJ_VENDOR_TARGET_TYPE}) |
| 54 | + # Skip tests for externally implemented entrypoints. |
| 55 | + list(APPEND skipped_list ${dep}) |
| 56 | + continue() |
| 57 | + endif() |
| 58 | + |
| 59 | + get_target_property(indirect_deps ${dep} "DEPS") |
| 60 | + list(APPEND indirect_list "${indirect_deps}") |
| 61 | + endforeach(dep) |
| 62 | + |
| 63 | + # Only add new indirect dependencies to check. |
| 64 | + list(APPEND checked_list "${unchecked_list}") |
| 65 | + list(REMOVE_DUPLICATES indirect_list) |
| 66 | + list(REMOVE_ITEM indirect_list checked_list) |
| 67 | + set(unchecked_list "${indirect_list}") |
| 68 | + list(LENGTH unchecked_list length) |
| 69 | + endwhile() |
| 70 | + |
60 | 71 | list(REMOVE_DUPLICATES object_files)
|
61 | 72 | set(${result} ${object_files} PARENT_SCOPE)
|
62 | 73 | list(REMOVE_DUPLICATES skipped_list)
|
|
0 commit comments