cmake: ZEPHYR_MODULES_NAMES list created before ext-root
Create the ZEPHYR_MODULES_NAMES list of zephyr modules present in the system before calling roots defined in `MODULE_EXT_ROOT`. This will allow external module roots to process based on Zephyr modules available in the system. Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
This commit is contained in:
parent
f1f0dadad3
commit
a1c49be42e
1 changed files with 15 additions and 7 deletions
|
@ -80,6 +80,20 @@ if(WEST OR ZEPHYR_MODULES)
|
|||
endforeach()
|
||||
endif()
|
||||
|
||||
if(EXISTS ${CMAKE_BINARY_DIR}/zephyr_modules.txt)
|
||||
file(STRINGS ${CMAKE_BINARY_DIR}/zephyr_modules.txt ZEPHYR_MODULES_TXT
|
||||
ENCODING UTF-8)
|
||||
|
||||
set(ZEPHYR_MODULE_NAMES)
|
||||
foreach(module ${ZEPHYR_MODULES_TXT})
|
||||
# Match "<name>":"<path>" for each line of file, each corresponding to
|
||||
# one module. The use of quotes is required due to CMake not supporting
|
||||
# lazy regexes (it supports greedy only).
|
||||
string(REGEX REPLACE "\"(.*)\":\".*\":\".*\"" "\\1" module_name ${module})
|
||||
list(APPEND ZEPHYR_MODULE_NAMES ${module_name})
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
foreach(root ${MODULE_EXT_ROOT})
|
||||
if(NOT EXISTS ${root})
|
||||
message(FATAL_ERROR "No `modules.cmake` found in module root `${root}`.")
|
||||
|
@ -88,11 +102,7 @@ if(WEST OR ZEPHYR_MODULES)
|
|||
include(${root}/modules/modules.cmake)
|
||||
endforeach()
|
||||
|
||||
if(EXISTS ${CMAKE_BINARY_DIR}/zephyr_modules.txt)
|
||||
file(STRINGS ${CMAKE_BINARY_DIR}/zephyr_modules.txt ZEPHYR_MODULES_TXT
|
||||
ENCODING UTF-8)
|
||||
set(ZEPHYR_MODULE_NAMES)
|
||||
|
||||
if(DEFINED ZEPHYR_MODULES_TXT)
|
||||
foreach(module ${ZEPHYR_MODULES_TXT})
|
||||
# Match "<name>":"<path>" for each line of file, each corresponding to
|
||||
# one module. The use of quotes is required due to CMake not supporting
|
||||
|
@ -102,8 +112,6 @@ if(WEST OR ZEPHYR_MODULES)
|
|||
string(REGEX REPLACE "\".*\":\"(.*)\":\".*\"" "\\1" module_path ${module})
|
||||
string(REGEX REPLACE "\".*\":\".*\":\"(.*)\"" "\\1" cmake_path ${module})
|
||||
|
||||
list(APPEND ZEPHYR_MODULE_NAMES ${module_name})
|
||||
|
||||
zephyr_string(SANITIZE TOUPPER MODULE_NAME_UPPER ${module_name})
|
||||
if(NOT ${MODULE_NAME_UPPER} STREQUAL CURRENT)
|
||||
set(ZEPHYR_${MODULE_NAME_UPPER}_MODULE_DIR ${module_path})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue