cmake: Introduce ZEPHYR_CURRENT_MODULE_NAME
Add a cmake variable for the current module's name. Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
This commit is contained in:
parent
8f0ae3b3a2
commit
fcaed380cd
|
@ -581,12 +581,14 @@ foreach(module_name ${ZEPHYR_MODULE_NAMES})
|
|||
# https://cmake.org/pipermail/cmake/2019-June/069547.html
|
||||
zephyr_string(SANITIZE TOUPPER MODULE_NAME_UPPER ${module_name})
|
||||
if(NOT ${ZEPHYR_${MODULE_NAME_UPPER}_CMAKE_DIR} STREQUAL "")
|
||||
set(ZEPHYR_CURRENT_MODULE_NAME ${ZEPHYR_${MODULE_NAME_UPPER}_MODULE_NAME})
|
||||
set(ZEPHYR_CURRENT_MODULE_DIR ${ZEPHYR_${MODULE_NAME_UPPER}_MODULE_DIR})
|
||||
set(ZEPHYR_CURRENT_CMAKE_DIR ${ZEPHYR_${MODULE_NAME_UPPER}_CMAKE_DIR})
|
||||
add_subdirectory(${ZEPHYR_CURRENT_CMAKE_DIR} ${CMAKE_BINARY_DIR}/modules/${module_name})
|
||||
endif()
|
||||
endforeach()
|
||||
# Done processing modules, clear ZEPHYR_CURRENT_MODULE_DIR and ZEPHYR_CURRENT_CMAKE_DIR.
|
||||
# Done processing modules, clear module variables
|
||||
set(ZEPHYR_CURRENT_MODULE_NAME)
|
||||
set(ZEPHYR_CURRENT_MODULE_DIR)
|
||||
set(ZEPHYR_CURRENT_CMAKE_DIR)
|
||||
|
||||
|
|
|
@ -137,6 +137,7 @@ if(WEST OR ZEPHYR_MODULES)
|
|||
|
||||
zephyr_string(SANITIZE TOUPPER MODULE_NAME_UPPER ${module_name})
|
||||
if(NOT ${MODULE_NAME_UPPER} STREQUAL CURRENT)
|
||||
set(ZEPHYR_${MODULE_NAME_UPPER}_MODULE_NAME ${module_name})
|
||||
set(ZEPHYR_${MODULE_NAME_UPPER}_MODULE_DIR ${module_path})
|
||||
set(ZEPHYR_${MODULE_NAME_UPPER}_CMAKE_DIR ${cmake_path})
|
||||
else()
|
||||
|
|
Loading…
Reference in a new issue