You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ar...@apache.org on 2024/09/24 13:06:33 UTC

(nuttx) branch master updated: cmake(bugfix):make sure the extra lib only added once

This is an automated email from the ASF dual-hosted git repository.

archer 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 5095955591 cmake(bugfix):make sure the extra lib only added once
5095955591 is described below

commit 50959555915556ecfa0977ce7051247007263ec8
Author: xuxin19 <xu...@xiaomi.com>
AuthorDate: Tue Sep 24 17:35:57 2024 +0800

    cmake(bugfix):make sure the extra lib only added once
    
    avoid duplicate definitions of target when
    `nuttx_add_extra_library` is called between different models at the same time
    
    Signed-off-by: xuxin19 <xu...@xiaomi.com>
---
 cmake/nuttx_add_library.cmake | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/cmake/nuttx_add_library.cmake b/cmake/nuttx_add_library.cmake
index 166b3a5cf1..62c84513d3 100644
--- a/cmake/nuttx_add_library.cmake
+++ b/cmake/nuttx_add_library.cmake
@@ -201,8 +201,10 @@ function(nuttx_add_extra_library)
     # define the target name of the extra library
     string(REGEX REPLACE "[^a-zA-Z0-9]" "_" extra_target "${extra_lib}")
     # set the absolute path of the library for the import target
-    nuttx_library_import(${extra_target} ${extra_lib})
-    set_property(GLOBAL APPEND PROPERTY NUTTX_EXTRA_LIBRARIES ${extra_target})
+    if(NOT TARGET ${extra_target})
+      nuttx_library_import(${extra_target} ${extra_lib})
+      set_property(GLOBAL APPEND PROPERTY NUTTX_EXTRA_LIBRARIES ${extra_target})
+    endif()
   endforeach()
 endfunction()