1# Add the required subdirectory and register it for linkage 2function(add_azrtos_component_dir dirname) 3 # Store the current list in a temp 4 set(tmp ${azrtos_targets}) 5 # Add the subdir 6 add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/lib/${dirname}) 7 # If there is a linker script defined, use it 8 if(EXISTS ${LINKER_SCRIPT}) 9 target_link_options(${dirname} INTERFACE -T ${LINKER_SCRIPT}) 10 endif() 11 # Add this target into the temp 12 list(APPEND tmp "azrtos::${dirname}") 13 # Copy the temp back up to the parent list 14 set(azrtos_targets ${tmp} PARENT_SCOPE) 15endfunction()