Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion cmake/modules/extensions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -463,9 +463,18 @@ endmacro()

# Provides amend functionality to a Zephyr library for out-of-tree usage.
#
# Usage:
# zephyr_library_amend([<dir>])
#
# When called from a Zephyr module, the corresponding zephyr library defined
# within Zephyr will be looked up.
#
# <dir>: Use '<dir>' as out-of-tree base directory from where the Zephyr
# library name shall be generated.
# <dir> can be used in cases where the structure for the library is not
# placed directly at the ZEPHYR_MODULE's root directory or for cases
# where the module integration file is located in a 'MODULE_EXT_ROOT'.
#
# Note, in order to ensure correct library when amending, the folder structure in the
# Zephyr module must resemble the structure used in Zephyr, as example:
#
Expand Down Expand Up @@ -496,7 +505,11 @@ macro(zephyr_library_amend)
message(FATAL_ERROR "Function only available for Zephyr modules.")
endif()

zephyr_library_get_current_dir_lib_name(${ZEPHYR_CURRENT_MODULE_DIR} lib_name)
if(${ARGC} EQUAL 1)
zephyr_library_get_current_dir_lib_name(${ARGV0} lib_name)
else()
zephyr_library_get_current_dir_lib_name(${ZEPHYR_CURRENT_MODULE_DIR} lib_name)
endif()

set(ZEPHYR_CURRENT_LIBRARY ${lib_name})
endmacro()
Expand Down