diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index d53a8192950..640b597e11b 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -50,7 +50,7 @@ if(CONFIG_TOOLS_WASM_BUILD OR CONFIG_INTERPRETERS_WAMR_BUILD_MODULES_FOR_NUTTX) ${CMAKE_COMMAND} -B${CMAKE_BINARY_DIR}/Wasm ${CMAKE_CURRENT_SOURCE_DIR}/Wasm -DAPPDIR=${APPDIR} -DTOPDIR=${TOPDIR} -DTOPBINDIR=${CMAKE_BINARY_DIR} -DKCONFIG_FILE_PATH=${KCONFIG_FILE_PATH} - -DWASI_SDK_PATH=$ENV{WASI_SDK_PATH} -DWASM_DIRS=${WASM_DIRS}) + -DWASI_SDK_PATH=$ENV{WASI_SDK_PATH} -DWASM_DIRS="${WASM_DIRS}") add_custom_target(wasm_build COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR}/Wasm) diff --git a/tools/Wasm/CMakeLists.txt b/tools/Wasm/CMakeLists.txt index 29c66a7245a..9272c20c5e9 100644 --- a/tools/Wasm/CMakeLists.txt +++ b/tools/Wasm/CMakeLists.txt @@ -95,6 +95,8 @@ function(nuttx_add_library) endfunction() +separate_arguments(WASM_DIRS) + # ~~~ # Add all the Wasm apps to the build process. foreach(WASM_APP ${WASM_DIRS}) diff --git a/tools/Wasm/WASI-SDK.cmake b/tools/Wasm/WASI-SDK.cmake index 34ffd4ff753..4785e0ec0e5 100644 --- a/tools/Wasm/WASI-SDK.cmake +++ b/tools/Wasm/WASI-SDK.cmake @@ -378,6 +378,13 @@ function(wasm_add_library) message(FATAL_ERROR "NAME is not provided.") endif() + # Check if the LIB_NAME (NAME) is already declared If it is, then skip the + # rest of the function + if(TARGET ${LIB_NAME}) + message(STATUS "Target ${LIB_NAME} already declared.") + return() + endif() + # Check if the LIB_SRCS (SRCS) is provided if(NOT LIB_SRCS) message(FATAL_ERROR "SRCS is not provided.")