cmake: introduce BUILD_COMPONENT_ALIASES

This commit makes it so that BUILD_COMPONENT holds only the component,
and a new property BUILD_COMPONENT_ALIASES hold the full name of the
component.

This also removes erroneous check for duplicate components, as this can
never happen:

(1) if two components have the same name but different prefixes,
the internal names are still unique between them

(2)if two components happen to have the same name and same prefix, the
latter would override the former
This commit is contained in:
Renz Christian Bagaporo
2019-08-27 20:40:29 +08:00
parent b69898257a
commit ecce2bc926
4 changed files with 25 additions and 11 deletions

View File

@@ -56,13 +56,8 @@ function(__component_get_target var name_or_alias)
foreach(component_target ${component_targets})
__component_get_property(_component_name ${component_target} COMPONENT_NAME)
if(name_or_alias STREQUAL _component_name)
# There should only be one component of the same name
if(NOT target)
set(target ${component_target})
else()
message(FATAL_ERROR "Multiple components with name '${name_or_alias}' found.")
return()
endif()
set(target ${component_target})
break()
endif()
endforeach()
set(${var} ${target} PARENT_SCOPE)
@@ -191,6 +186,7 @@ function(__component_add component_dir prefix)
__component_set_property(${component_target} COMPONENT_NAME ${component_name})
__component_set_property(${component_target} COMPONENT_DIR ${component_dir})
__component_set_property(${component_target} COMPONENT_ALIAS ${component_alias})
__component_set_property(${component_target} __PREFIX ${prefix})
# Set Kconfig related properties on the component