Skip to content

Commit 5945b55

Browse files
committed
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>
1 parent 791ec93 commit 5945b55

3 files changed

Lines changed: 25 additions & 2 deletions

File tree

CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,16 @@ set(ENV{HOST_OTHER} n)
230230

231231
include(nuttx_sethost)
232232

233+
option(NXTMPDIR "Create the nxtmpdir folder for third-party packages." OFF)
234+
235+
include(nuttx_3rdparty)
236+
237+
if(NXTMPDIR)
238+
nuttx_make_nxtmpdir()
239+
else()
240+
nuttx_remove_nxtmpdir()
241+
endif()
242+
233243
include(nuttx_parse_function_args)
234244
include(nuttx_add_subdirectory)
235245
include(nuttx_create_symlink)

arch/risc-v/src/common/espressif/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,6 @@ if(NOT IS_DIRECTORY "${ESP_HAL_3RDPARTY_REPO}")
243243
# NXTMPDIR contains a cached version of the esp-hal-3rdparty repository, which
244244
# is located on nuttx/../nxtmpdir/esp-hal-3rdparty if it exists.
245245
if(NXTMPDIR)
246-
include(${NUTTX_DIR}/cmake/nuttx_3rdparty.cmake)
247-
nuttx_make_nxtmpdir()
248246
set(ESP_HAL_NXTMPDIR_CACHE "${NXTMPDIR_PATH}/${ESP_HAL_3RDPARTY_REPO_NAME}")
249247
get_filename_component(ESP_HAL_NXTMPDIR_CACHE "${ESP_HAL_NXTMPDIR_CACHE}"
250248
REALPATH)

cmake/nuttx_3rdparty.cmake

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,21 @@ function(nuttx_make_nxtmpdir)
4040
endif()
4141
endfunction()
4242

43+
# ~~~
44+
# nuttx_remove_nxtmpdir
45+
#
46+
# Description:
47+
# Remove the third-party cache directory under nuttx/../nxtmpdir
48+
#
49+
# ~~~
50+
51+
function(nuttx_remove_nxtmpdir)
52+
set(_nxtmpdir "${NUTTX_DIR}/../nxtmpdir")
53+
if(EXISTS "${_nxtmpdir}")
54+
file(REMOVE_RECURSE "${_nxtmpdir}")
55+
endif()
56+
endfunction()
57+
4358
# ~~~
4459
# nuttx_check_git_hash
4560
#

0 commit comments

Comments
 (0)