This is an automated email from the ASF dual-hosted git repository. acassis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push: new 36b2b90bc0 cmake/mkconfig: add support of set custom command options to config.h 36b2b90bc0 is described below commit 36b2b90bc01ae3da3918d5af2eab1f81200ca4e1 Author: chao an <anchao.arc...@bytedance.com> AuthorDate: Fri Jan 17 21:35:36 2025 +0800 cmake/mkconfig: add support of set custom command options to config.h add support of set custom command options to config.h Use the -D parameter to pass the config to header file. NOTE which must begin with the CONFIG_ prefix. eg: cmake -DCONFIG_AAA=1 -DCONFIG_BBB=1 -B build -DBOARD_CONFIG=sim/nsh -GNinja Signed-off-by: chao an <anchao.arc...@bytedance.com> --- cmake/nuttx_mkconfig.cmake | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/cmake/nuttx_mkconfig.cmake b/cmake/nuttx_mkconfig.cmake index e5ff721a44..8b334c2b67 100644 --- a/cmake/nuttx_mkconfig.cmake +++ b/cmake/nuttx_mkconfig.cmake @@ -135,6 +135,22 @@ foreach(NameAndValue ${ConfigContents}) endif() endforeach() +# cmake-format: off +# add support of set custom command options to config.h +# Use the -D parameter to pass the config to header file. +# NOTE which must start with the CONFIG_ prefix. +# eg: +# cmake -DCONFIG_AAA=1 -DCONFIG_BBB=1 -B build -DBOARD_CONFIG=sim/nsh -GNinja +# cmake-format: on + +get_cmake_property(cache_vars CACHE_VARIABLES) +foreach(var ${cache_vars}) + string(REGEX MATCH "^CONFIG_[^=]+" name ${var}) + if(name) + file(APPEND ${CONFIG_H} "#define ${var} ${${var}}\n") + endif() +endforeach() + file(APPEND ${CONFIG_H} "\n/* Sanity Checks *****************************************/\n\n") file(APPEND ${CONFIG_H}