cmake:fix add_user_library module archive issue

STATIC target export in BINDIR/staging/ directory by `cmake --install`

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
This commit is contained in:
xuxin19 2023-08-14 10:44:17 +08:00 committed by Mateusz Szafoni
parent 756f6f425a
commit d18988521f

View File

@ -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()