Skip to content

Commit

Permalink
[cmake] install with static library dependencies (#194)
Browse files Browse the repository at this point in the history
This commit includes the following changes:
- Install static library dependencies
- Install commissioner-common: applications need to link against both
  commissioner and commissioner-common.
- Remove unused linking of ncurses.
  • Loading branch information
wgtdkp authored Apr 20, 2021
1 parent d06a215 commit 26702ff
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 23 deletions.
1 change: 0 additions & 1 deletion src/app/cli/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ target_include_directories(commissioner-cli
target_link_libraries(commissioner-cli
PRIVATE
commissioner-app
ncurses
pthread
readline
)
Expand Down
10 changes: 4 additions & 6 deletions src/common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,10 @@ target_include_directories(commissioner-common
${PROJECT_SOURCE_DIR}/src
)

if (BUILD_SHARED_LIBS)
install(TARGETS commissioner-common
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
endif()
install(TARGETS commissioner-common
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)

if (OT_COMM_TEST)
add_library(commissioner-common-test OBJECT
Expand Down
39 changes: 23 additions & 16 deletions src/library/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -109,28 +109,35 @@ install(TARGETS commissioner
## Install third-party shared libraries. We need to install
## those shared libraries to enable commissioner-cli.
##
## We here install the built .so files directly
## We here install the .a/.so files directly
## because those third-party libraries are included
## as EXCLUDE_FROM_ALL, which means `install()` is
## disabled for them (intended).
if (BUILD_SHARED_LIBS)
install(FILES
$<$<BOOL:${OT_COMM_CCM}>:$<TARGET_FILE:cn-cbor::cn-cbor>>
$<$<BOOL:${OT_COMM_CCM}>:$<TARGET_FILE:cose>>
$<$<BOOL:${OT_COMM_APP}>:$<TARGET_FILE:mdns>>
$<TARGET_FILE:mbedtls>
$<TARGET_FILE:mbedx509>
$<TARGET_FILE:mbedcrypto>
$<TARGET_FILE:fmt::fmt>
$<TARGET_FILE:event_core_shared>
$<TARGET_FILE:event_pthreads_shared>
DESTINATION lib
)

## Update ldconfig links and caches.
install(CODE "execute_process(COMMAND sudo ldconfig)")
if (BUILD_SHARED_LIBS)
set(EVENT_CORE event_core_shared)
set(EVENT_PTHREADS event_pthreads_shared)
else()
set(EVENT_CORE event_core_static)
set(EVENT_PTHREADS event_pthreads_static)
endif()

install(FILES
$<$<BOOL:${OT_COMM_CCM}>:$<TARGET_FILE:cn-cbor::cn-cbor>>
$<$<BOOL:${OT_COMM_CCM}>:$<TARGET_FILE:cose>>
$<$<BOOL:${OT_COMM_APP}>:$<TARGET_FILE:mdns>>
$<TARGET_FILE:mbedtls>
$<TARGET_FILE:mbedx509>
$<TARGET_FILE:mbedcrypto>
$<TARGET_FILE:fmt::fmt>
$<TARGET_FILE:${EVENT_CORE}>
$<TARGET_FILE:${EVENT_PTHREADS}>
DESTINATION lib
)

## Update ldconfig links and caches.
install(CODE "execute_process(COMMAND sudo ldconfig)")

install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/commissioner
DESTINATION include
)
Expand Down

0 comments on commit 26702ff

Please sign in to comment.