From 9fc8778f9e04075a4b3c73c09d6dffed9184b138 Mon Sep 17 00:00:00 2001 From: Jacob McDonnell Date: Wed, 25 Feb 2026 21:51:57 -0500 Subject: feat: rerun cmake after genconfig target Rerun the cmake command after genconfig runs, allowing cmake configurations to be stored in the defconfig files. --- CMakeLists.txt | 2 +- cmake/Kconfig.cmake | 12 +++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2a13540..999ea9c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,7 +9,7 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) include(Kconfig) if(CONFIG_USE_TOOLCHAIN_FILE) - include(${CONFIG_CMAKE_TOOLCHAIN_FILE}) + include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/${CONFIG_CMAKE_TOOLCHAIN_FILE}) endif() include_directories(${CMAKE_BINARY_DIR}) diff --git a/cmake/Kconfig.cmake b/cmake/Kconfig.cmake index e19a539..0b2dfbb 100644 --- a/cmake/Kconfig.cmake +++ b/cmake/Kconfig.cmake @@ -2,18 +2,15 @@ set(TOOL_DIR ${CMAKE_CURRENT_SOURCE_DIR}/tools) set(KCONFIG_DIR ${TOOL_DIR}/Kconfiglib) set(LOCAL_CONFIG ${CMAKE_CURRENT_SOURCE_DIR}/.config) -function(parse_dot_config) -endfunction() - if(DEFCONFIG) - execute_process(COMMAND ${KCONFIG_DIR}/defconfig.py ${CMAKE_CURRENT_SOURCE_DIR}/configs/${DEFCONFIG}) + execute_process( + COMMAND ${KCONFIG_DIR}/defconfig.py ${CMAKE_CURRENT_SOURCE_DIR}/configs/${DEFCONFIG} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + ) else() message(FATAL_ERROR "DEFCONFIG not set.") endif() -#if(EXISTS ${LOCAL_CONFIG}) -#endif() - add_custom_target(menuconfig COMMAND ${KCONFIG_DIR}/menuconfig.py WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} @@ -22,6 +19,7 @@ add_custom_target(menuconfig add_custom_target(genconfig COMMAND ${KCONFIG_DIR}/genconfig.py --header-path ${CMAKE_BINARY_DIR}/generated.h --config-out ${CMAKE_BINARY_DIR}/config.make COMMAND ${TOOL_DIR}/make-cmake-config ${CMAKE_BINARY_DIR}/config.make + COMMAND cmake -B ${CMAKE_BINARY_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) -- cgit v1.2.3