Skip to content

Commit 157e123

Browse files
tejlmandnordicjm
authored andcommitted
[nrf fromlist] cmake: fix Zephyr module ext order
Upstream PR #: 87962 MODULE_EXT_ROOT allows Zephyr modules to provide glue code for Zephyr modules using `cmake-ext: True` and/or `kconfig-ext:True`. A module ext root provides a `modules.cmake` file which defines variables like: `set(ZEPHYR_FOO_CMAKE_DIR <glue-code-path>/foo)` It is intended that a downstream module can replace Zephyr's default glue code, which again can be replaced further downstream. Setting values in first modules.cmake (Zephyr's) are replaced by later processed modules.cmake (downstream) when the setting name is identical. Therefore the module ext root list should not be reversed, and Zephyr itself should be placed as first entry in the list. Signed-off-by: Torsten Rasmussen <[email protected]> (cherry picked from commit 83976563b4175e72841b002d35350abb16c6aea8)
1 parent 23d0c95 commit 157e123

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Diff for: cmake/modules/zephyr_module.cmake

+5-5
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,6 @@ if(WEST OR ZEPHYR_MODULES)
8585
endforeach()
8686
endif()
8787

88-
# Append ZEPHYR_BASE as a default ext root at lowest priority
89-
list(APPEND MODULE_EXT_ROOT ${ZEPHYR_BASE})
90-
9188
if(EXISTS ${cmake_modules_file})
9289
file(STRINGS ${cmake_modules_file} zephyr_modules_txt ENCODING UTF-8)
9390
endif()
@@ -114,9 +111,12 @@ if(WEST OR ZEPHYR_MODULES)
114111
list(APPEND SYSBUILD_MODULE_NAMES ${module_name})
115112
endforeach()
116113

114+
# Prepend ZEPHYR_BASE as a default ext root at lowest priority
115+
list(PREPEND MODULE_EXT_ROOT ${ZEPHYR_BASE})
116+
117117
# MODULE_EXT_ROOT is process order which means Zephyr module roots processed
118-
# later wins. therefore we reverse the list before processing.
119-
list(REVERSE MODULE_EXT_ROOT)
118+
# later wins. Thus processing Zephyr first, and modules thereafter allows them
119+
# to overrule default glue folder settings provided by higher level modules.cmake.
120120
foreach(root ${MODULE_EXT_ROOT})
121121
set(module_cmake_file_path modules/modules.cmake)
122122
if(NOT EXISTS ${root}/${module_cmake_file_path})

0 commit comments

Comments
 (0)