cmake/add_library: enable library install by default

enable library install by default to support nuttx export for cmake

nuttx$ cmake --install build  --prefix $PWD/build/staging/
-- Install configuration: ""
-- Installing: nuttx/build/staging/lib/libarch.a
-- Installing: nuttx/build/staging/lib/libbinfmt.a
-- Installing: nuttx/build/staging/lib/libdrivers.a
-- Installing: nuttx/build/staging/lib/libfs.a
...

Signed-off-by: chao an <anchao@lixiang.com>
This commit is contained in:
chao an 2024-07-02 12:07:28 +08:00 committed by Xiang Xiao
parent 04c19bb1c9
commit fc716802c0

View File

@ -51,6 +51,9 @@ function(nuttx_add_library_internal target)
target_include_directories(
${target}
PRIVATE $<GENEX_EVAL:$<TARGET_PROPERTY:nuttx,NUTTX_INCLUDE_DIRECTORIES>>)
# Set install config for all library
install(TARGETS ${target})
endfunction()
# Auxiliary libraries
@ -101,9 +104,6 @@ function(nuttx_add_system_library target)
# add to list of libraries to link to final nuttx binary
set_property(GLOBAL APPEND PROPERTY NUTTX_SYSTEM_LIBRARIES ${target})
# install to library dir
install(TARGETS ${target} DESTINATION lib)
endfunction()
# Kernel Libraries
@ -183,11 +183,6 @@ function(nuttx_add_library target)
set_property(GLOBAL APPEND PROPERTY NUTTX_SYSTEM_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()