cmake: Moved the creation of the nxtmpdir folder to the root CMake file

- Moved the creation of the `nxtmpdir` folder for third-party packages to the root  `CMakeLists.txt` file.

cmake/nuttx_3rdparty.cmake

- Add the nuttx_remove_nxtmpdir function to remove the third-party cache directory under nuttx/../nxtmpdir

Signed-off-by: simbit18 <simbit18@gmail.com>
This commit is contained in:
simbit18
2026-04-16 14:30:03 +02:00
committed by Lup Yuen Lee
parent 9035fba275
commit b37b22eacd
3 changed files with 25 additions and 2 deletions
+10
View File
@@ -230,6 +230,16 @@ set(ENV{HOST_OTHER} n)
include(nuttx_sethost)
option(NXTMPDIR "Create the nxtmpdir folder for third-party packages." OFF)
include(nuttx_3rdparty)
if(NXTMPDIR)
nuttx_make_nxtmpdir()
else()
nuttx_remove_nxtmpdir()
endif()
include(nuttx_parse_function_args)
include(nuttx_add_subdirectory)
include(nuttx_create_symlink)
@@ -243,8 +243,6 @@ if(NOT IS_DIRECTORY "${ESP_HAL_3RDPARTY_REPO}")
# NXTMPDIR contains a cached version of the esp-hal-3rdparty repository, which
# is located on nuttx/../nxtmpdir/esp-hal-3rdparty if it exists.
if(NXTMPDIR)
include(${NUTTX_DIR}/cmake/nuttx_3rdparty.cmake)
nuttx_make_nxtmpdir()
set(ESP_HAL_NXTMPDIR_CACHE "${NXTMPDIR_PATH}/${ESP_HAL_3RDPARTY_REPO_NAME}")
get_filename_component(ESP_HAL_NXTMPDIR_CACHE "${ESP_HAL_NXTMPDIR_CACHE}"
REALPATH)
+15
View File
@@ -40,6 +40,21 @@ function(nuttx_make_nxtmpdir)
endif()
endfunction()
# ~~~
# nuttx_remove_nxtmpdir
#
# Description:
# Remove the third-party cache directory under nuttx/../nxtmpdir
#
# ~~~
function(nuttx_remove_nxtmpdir)
set(_nxtmpdir "${NUTTX_DIR}/../nxtmpdir")
if(EXISTS "${_nxtmpdir}")
file(REMOVE_RECURSE "${_nxtmpdir}")
endif()
endfunction()
# ~~~
# nuttx_check_git_hash
#