abseil / abseil/abseil-cpp

How to link abseil as a static library to another static library in Cmake

Open
#1,087 0 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
C++
Stars
18.1k
Forks
3.2k
Avg merge
20h 36m
Merged PRs (30d)
1

Description

I wrote a library myself, he can compile as a static library or a dynamic library, if I compile as a dynamic library, I rely on the following libraries from absl below:
```cmake
target_link_libraries(${TARGET_NAME}
PUBLIC
${CMAKE_DL_LIBS}
absl::base
absl::strings
absl::status
absl::statusor
absl::flat_hash_map
${TCE_ZLIB_LIBS})
```
But when I want to compile it as a static library, the problem comes, after I do the static packaging as below, it will be missing the dependencies of these targets that I depend on, how can I get all the target dependencies?
``` cmake
set(EXTERN_OBJECTS
$
$
$
$
$
$
)

add_custom_target(combined ALL
COMMAND ${CMAKE_AR} rcsT
${LIBRARY_NAME}
${EXTERN_OBJECTS} )
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.