Skip to content

Commit 2bf26ec

Browse files
tejlmandnashif
authored andcommitted
cmake: modules: remove Zephyr module duplicates from ZEPHYR_MODULE_NAMES
This allows users to overrule a module from command line. As example, the Zephyr build system loads the module FOO from `modules/FOO`, but user has a custom FOO locally at `custom/FOO` and would like to use this module instead of manifest specified. If user does `-DZEPHYR_EXTRA_MODULES=custom/FOO` the following error will be seen: ``` The binary directory build/modules/FOO is already used to build a source directory. It cannot be used to build source directory custom/FOO Specify a unique binary directory name. ``` Removing duplicates from the list allows a user to use `-DZEPHYR_EXTRA_MODULES=custom/FOO` and thus replace `modules/FOO` for the current build. Signed-off-by: Torsten Rasmussen <[email protected]>
1 parent 46f2f8c commit 2bf26ec

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

cmake/zephyr_module.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,3 +122,5 @@ else()
122122
)
123123

124124
endif()
125+
126+
list(REMOVE_DUPLICATES ZEPHYR_MODULE_NAMES)

doc/guides/modules.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,14 @@ variable or by adding a :makevar:`ZEPHYR_EXTRA_MODULES` line to ``.zephyrrc``
392392
useful if you want to keep the list of modules found with west and also add
393393
your own.
394394

395+
.. note::
396+
If the module ``FOO`` is provided by :ref:`west <west>` but also given with
397+
``-DZEPHYR_EXTRA_MODULES=/<path>/foo`` then the module given by the command
398+
line variable :makevar:`ZEPHYR_EXTRA_MODULES` will take precedence.
399+
This allows you to use a custom version of ``FOO`` when building and still
400+
use other Zephyr modules provided by :ref:`west <west>`.
401+
This can for example be useful for special test purposes.
402+
395403
See the section about :ref:`west-multi-repo` for more details.
396404

397405
Finally, you can also specify the list of modules yourself in various ways, or

0 commit comments

Comments
 (0)