cmake: Merge extra Zephyr modules from multiple sources
Extra Zephyr modules can be provided via the EXTRA_ZEPHYR_MODULES CMake list variable. Previously, if this variable were set in multiple places (e.g. local CMake variable, cache variable set via -D, environment variable), Zephyr will pick one source based on zephyr_get's documented hierarchy and ignore the others. Add the MERGE keyword when EXTRA_ZEPHYR_MODULES is read so that the list of Zephyr modules is merged from all sources if this variable is set in multiple places. An example where this can be useful is when integrating additional Zephyr modules with a vendor's Zephyr-based application whose build system already contains usage of EXTRA_ZEPHYR_MODULES. Signed-off-by: Kesavan Yogeswaran <hikes@google.com>
This commit is contained in:
committed by
Chris Friedt
parent
2134fbcecf
commit
493ce8efa6
@@ -36,7 +36,7 @@ if(ZEPHYR_MODULES)
|
||||
set(ZEPHYR_MODULES_ARG "--modules" ${ZEPHYR_MODULES})
|
||||
endif()
|
||||
|
||||
zephyr_get(EXTRA_ZEPHYR_MODULES VAR EXTRA_ZEPHYR_MODULES ZEPHYR_EXTRA_MODULES)
|
||||
zephyr_get(EXTRA_ZEPHYR_MODULES MERGE VAR EXTRA_ZEPHYR_MODULES ZEPHYR_EXTRA_MODULES)
|
||||
if(EXTRA_ZEPHYR_MODULES)
|
||||
set(EXTRA_ZEPHYR_MODULES_ARG "--extra-modules" ${EXTRA_ZEPHYR_MODULES})
|
||||
endif()
|
||||
|
||||
@@ -424,9 +424,11 @@ this variable is defined unless you are adding a new module. The build system
|
||||
knows how to use west to set :makevar:`ZEPHYR_MODULES`. You can add additional
|
||||
modules to this list by setting the :makevar:`EXTRA_ZEPHYR_MODULES` CMake
|
||||
variable or by adding a :makevar:`EXTRA_ZEPHYR_MODULES` line to ``.zephyrrc``
|
||||
(See the section on :ref:`env_vars` for more details). This can be
|
||||
useful if you want to keep the list of modules found with west and also add
|
||||
your own.
|
||||
(See the section on :ref:`env_vars` for more details). This can be useful if you
|
||||
want to keep the list of modules found with west and also add your own. If
|
||||
:makevar:`EXTRA_ZEPHYR_MODULES` is set in multiple places, for example both as
|
||||
an environment variable and as a CMake variable, the final list of additional
|
||||
modules will be the merged result of all sources.
|
||||
|
||||
.. note::
|
||||
If the module ``FOO`` is provided by :ref:`west <west>` but also given with
|
||||
|
||||
Reference in New Issue
Block a user