This is an automated email from the ASF dual-hosted git repository.
jerpelea 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 08a2de27cf2 cmake: Fix SIM_TOOLCHAIN using CMake on macOS.
08a2de27cf2 is described below
commit 08a2de27cf2d078d0a25e14760b929f647f0cec3
Author: Shoji Tokunaga <[email protected]>
AuthorDate: Sat May 23 04:21:20 2026 +0900
cmake: Fix SIM_TOOLCHAIN using CMake on macOS.
Fix an issue where `SIM_TOOLCHAIN_GCC` was incorrectly set when
configuring `sim:nsh` using CMake on macOS.
Ensure that `nuttx_sethost()` is called before `nuttx_olddefconfig()`.
Signed-off-by: Shoji Tokunaga <[email protected]>
---
CMakeLists.txt | 7 ++++---
cmake/nuttx_kconfig.cmake | 20 ++++++++++++++++++--
cmake/nuttx_sethost.cmake | 14 +++++++++++++-
3 files changed, 35 insertions(+), 6 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 77755168edf..80fa88636ca 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -355,6 +355,10 @@ if(NOT EXISTS ${CMAKE_BINARY_DIR}/.config OR NOT
"${NUTTX_DEFCONFIG}" STREQUAL
set(ENV{KCONFIG_CONFIG} ${CMAKE_BINARY_DIR}/.config.compressed)
+ # Define host before the first olddefconfig so host-dependent defaults, such
+ # as the sim toolchain choice on macOS, resolve the same way as configure.sh.
+ nuttx_sethost(CONFIG_FILE ${CMAKE_BINARY_DIR}/.config.compressed)
+
# Do olddefconfig step to expand the abbreviated defconfig into normal config
nuttx_olddefconfig()
@@ -379,9 +383,6 @@ if(NOT EXISTS ${CMAKE_BINARY_DIR}/.config OR NOT
"${NUTTX_DEFCONFIG}" STREQUAL
configure_file(${CMAKE_BINARY_DIR}/.config ${CMAKE_BINARY_DIR}/.config.orig
COPYONLY)
- # We define host
- nuttx_sethost()
-
set(NUTTX_DEFCONFIG_SAVED
${NUTTX_DEFCONFIG}
CACHE INTERNAL "Saved defconfig path" FORCE)
diff --git a/cmake/nuttx_kconfig.cmake b/cmake/nuttx_kconfig.cmake
index cc55acc9f86..eb5c6eb3268 100644
--- a/cmake/nuttx_kconfig.cmake
+++ b/cmake/nuttx_kconfig.cmake
@@ -231,9 +231,25 @@ function(nuttx_olddefconfig)
endfunction()
function(nuttx_setconfig)
- set(ENV{KCONFIG_CONFIG} ${CMAKE_BINARY_DIR}/.config)
+ cmake_parse_arguments(SETCONFIG "" "CONFIG_FILE" "SETTINGS" ${ARGN})
+
+ if(SETCONFIG_UNPARSED_ARGUMENTS)
+ message(
+ FATAL_ERROR
+ "nuttx_setconfig: unknown arguments: ${SETCONFIG_UNPARSED_ARGUMENTS}")
+ endif()
+
+ if(NOT SETCONFIG_SETTINGS)
+ message(FATAL_ERROR "nuttx_setconfig: SETTINGS is required")
+ endif()
+
+ if(NOT SETCONFIG_CONFIG_FILE)
+ set(SETCONFIG_CONFIG_FILE ${CMAKE_BINARY_DIR}/.config)
+ endif()
+
+ set(ENV{KCONFIG_CONFIG} ${SETCONFIG_CONFIG_FILE})
execute_process(
- COMMAND setconfig ${ARGN} --kconfig ${NUTTX_DIR}/Kconfig
+ COMMAND setconfig ${SETCONFIG_SETTINGS} --kconfig ${NUTTX_DIR}/Kconfig
ERROR_VARIABLE KCONFIG_ERROR
OUTPUT_VARIABLE KCONFIG_OUTPUT
RESULT_VARIABLE KCONFIG_STATUS
diff --git a/cmake/nuttx_sethost.cmake b/cmake/nuttx_sethost.cmake
index 54788b49fb4..f26399b587b 100644
--- a/cmake/nuttx_sethost.cmake
+++ b/cmake/nuttx_sethost.cmake
@@ -23,6 +23,18 @@
include(nuttx_kconfig)
function(nuttx_sethost)
+ set(config_file ${CMAKE_BINARY_DIR}/.config)
+ cmake_parse_arguments(SETHOST "" "CONFIG_FILE" "" ${ARGN})
+
+ if(SETHOST_UNPARSED_ARGUMENTS)
+ message(
+ FATAL_ERROR
+ "nuttx_sethost: unknown arguments: ${SETHOST_UNPARSED_ARGUMENTS}")
+ endif()
+
+ if(SETHOST_CONFIG_FILE)
+ set(config_file ${SETHOST_CONFIG_FILE})
+ endif()
if(CMAKE_HOST_WIN32)
#
https://learn.microsoft.com/en-us/windows/win32/winprog64/wow64-implementation-details
@@ -104,5 +116,5 @@ function(nuttx_sethost)
endif()
endif()
# message(" nuttx_setconfig: ${NUTTX_SYSTEM_SETHOST}")
- nuttx_setconfig("${NUTTX_SYSTEM_SETHOST}")
+ nuttx_setconfig(CONFIG_FILE ${config_file} SETTINGS ${NUTTX_SYSTEM_SETHOST})
endfunction()