From d18988521f6fb77019f0250ba2be6de5e547c8dd Mon Sep 17 00:00:00 2001 From: xuxin19 Date: Mon, 14 Aug 2023 10:44:17 +0800 Subject: [PATCH] cmake:fix add_user_library module archive issue STATIC target export in BINDIR/staging/ directory by `cmake --install` Signed-off-by: xuxin19 --- cmake/nuttx_add_library.cmake | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/cmake/nuttx_add_library.cmake b/cmake/nuttx_add_library.cmake index d80e8be67a..9795aed5f1 100644 --- a/cmake/nuttx_add_library.cmake +++ b/cmake/nuttx_add_library.cmake @@ -73,10 +73,10 @@ function(nuttx_add_user_library target) nuttx_add_library_internal(${target} ${ARGN}) # link to final libapps - target_link_libraries(apps INTERFACE ${target}) + target_link_libraries(apps PRIVATE ${target}) # add apps/include to include path - target_include_directories(${target} INTERFACE ${NUTTX_APPS_DIR}/include) + target_include_directories(${target} PRIVATE ${NUTTX_APPS_DIR}/include) endfunction() # System Libraries @@ -173,6 +173,11 @@ function(nuttx_add_library target) set_property(GLOBAL APPEND PROPERTY NUTTX_EXTRA_LIBRARIES ${target}) + get_target_property(target_type ${target} TYPE) + if(${target_type} STREQUAL "STATIC_LIBRARY") + install(TARGETS ${target} ARCHIVE DESTINATION ${CMAKE_BINARY_DIR}/staging) + endif() + nuttx_add_library_internal(${target}) endfunction()