Skip to content

Commit

Permalink
zephyr_module.cmake: restore ability to build without modules
Browse files Browse the repository at this point in the history
Kconfig.modules used to be an empty file when no modules. PR #14667 /
commit bd7569f "cmake: Extracted Zephyr module processing into
python script" unintentionally changed that to no Kconfig.modules file
at all when no west and no modules. kconfig.py doesn't like that and
crashes. Restore the empty file.

Signed-off-by: Marc Herbert <[email protected]>
  • Loading branch information
marc-hb authored and galak committed Mar 31, 2019
1 parent 5900a6f commit c240b69
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion cmake/zephyr_module.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ if(ZEPHYR_EXTRA_MODULES)
set(ZEPHYR_EXTRA_MODULES_ARG "--extra-modules" ${ZEPHYR_EXTRA_MODULES})
endif()

set(KCONFIG_MODULES_FILE ${CMAKE_BINARY_DIR}/Kconfig.modules)

if(WEST OR ZEPHYR_MODULES)
# Zephyr module uses west, so only call it if west is installed or
# ZEPHYR_MODULES was provided as argument to CMake.
Expand All @@ -24,7 +26,7 @@ if(WEST OR ZEPHYR_MODULES)
${PYTHON_EXECUTABLE} ${ZEPHYR_BASE}/scripts/zephyr_module.py
${ZEPHYR_MODULES_ARG}
${ZEPHYR_EXTRA_MODULES_ARG}
--kconfig-out ${CMAKE_BINARY_DIR}/Kconfig.modules
--kconfig-out ${KCONFIG_MODULES_FILE}
--cmake-out ${CMAKE_BINARY_DIR}/zephyr_modules.txt
ERROR_VARIABLE
zephyr_module_error_text
Expand All @@ -35,4 +37,11 @@ if(WEST OR ZEPHYR_MODULES)
if(${zephyr_module_return})
message(FATAL_ERROR "${zephyr_module_error_text}")
endif()

else()

file(WRITE ${KCONFIG_MODULES_FILE}
"# No west and no modules\n"
)

endif()

0 comments on commit c240b69

Please sign in to comment.