1function (collector_create name base) 2 set_property (GLOBAL PROPERTY "COLLECT_${name}_LIST") 3 set_property (GLOBAL PROPERTY "COLLECT_${name}_BASE" "${base}") 4endfunction (collector_create) 5 6function (collector_list var name) 7 get_property (_list GLOBAL PROPERTY "COLLECT_${name}_LIST") 8 set (${var} "${_list}" PARENT_SCOPE) 9endfunction (collector_list) 10 11function (collector_base var name) 12 get_property (_base GLOBAL PROPERTY "COLLECT_${name}_BASE") 13 set (${var} "${_base}" PARENT_SCOPE) 14endfunction (collector_base) 15 16function (collect name) 17 collector_base (_base ${name}) 18 string(COMPARE NOTEQUAL "${_base}" "" _is_rel) 19 set (_list) 20 foreach (s IN LISTS ARGN) 21 if (_is_rel) 22 get_filename_component (s "${s}" ABSOLUTE) 23 file (RELATIVE_PATH s "${_base}" "${s}") 24 else (_is_rel) 25 get_filename_component (ts "${s}" ABSOLUTE) 26 if (EXISTS "${ts}") 27 set (s "${ts}") 28 endif (EXISTS "${ts}") 29 endif (_is_rel) 30 list (APPEND _list "${s}") 31 endforeach () 32 set_property (GLOBAL APPEND PROPERTY "COLLECT_${name}_LIST" "${_list}") 33endfunction (collect) 34 35# Create global collectors 36collector_create (PROJECT_INC_DIRS "") 37collector_create (PROJECT_LIB_DIRS "") 38collector_create (PROJECT_LIB_DEPS "") 39