cmake: zephyr modules: sanitize all module name when used as variable
The introduction of Zephyr module glue code in the Zephyr repository introduces a Kconfig variable in the form of: `config ZEPHYR_<MODULE_NAME>_MODULE`. All Kconfig variables go into `autoconf.h`, therefore it is necessary to sanitize the Kconfig variable, so that it does not contain special characters. To ensure consistent variable name, then the module name will be sanitized in all variable use in both Kconfig and CMake. The sanitization is done be replacing all special characters with an underscore, `_`. Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
This commit is contained in:
parent
0ce0f63036
commit
3d88083bf1
8 changed files with 68 additions and 12 deletions
|
@ -454,7 +454,7 @@ foreach(module_name ${ZEPHYR_MODULE_NAMES})
|
|||
# this binary_dir is created but stays empty. Object files land in
|
||||
# the main binary dir instead.
|
||||
# https://cmake.org/pipermail/cmake/2019-June/069547.html
|
||||
string(TOUPPER ${module_name} MODULE_NAME_UPPER)
|
||||
zephyr_string(SANITIZE TOUPPER MODULE_NAME_UPPER ${module_name})
|
||||
if(NOT ${ZEPHYR_${MODULE_NAME_UPPER}_CMAKE_DIR} STREQUAL "")
|
||||
set(ZEPHYR_CURRENT_MODULE_DIR ${ZEPHYR_${MODULE_NAME_UPPER}_MODULE_DIR})
|
||||
set(ZEPHYR_CURRENT_CMAKE_DIR ${ZEPHYR_${MODULE_NAME_UPPER}_CMAKE_DIR})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue