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 endif (_is_rel) 25 list (APPEND _list "${s}") 26 endforeach () 27 set_property (GLOBAL APPEND PROPERTY "COLLECT_${name}_LIST" "${_list}") 28endfunction (collect) 29 30# Create global collectors 31collector_create (PROJECT_INC_DIRS "") 32collector_create (PROJECT_LIB_DIRS "") 33collector_create (PROJECT_LIB_DEPS "") 34collector_create (PROJECT_HDR_TESTS "") 35 36