diff --git a/CMakeLists.txt b/CMakeLists.txt index 82af32ddb64..77755168edf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/arch/risc-v/src/common/espressif/CMakeLists.txt b/arch/risc-v/src/common/espressif/CMakeLists.txt index c948bd9b385..10e1415e0c9 100644 --- a/arch/risc-v/src/common/espressif/CMakeLists.txt +++ b/arch/risc-v/src/common/espressif/CMakeLists.txt @@ -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) diff --git a/cmake/nuttx_3rdparty.cmake b/cmake/nuttx_3rdparty.cmake index 2bd3d0835da..593bbcd84b1 100644 --- a/cmake/nuttx_3rdparty.cmake +++ b/cmake/nuttx_3rdparty.cmake @@ -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 #