abseil / abseil/abseil-cpp

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

未关闭
#1,087 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
question
主要语言
C++
星标
18.1k
派生
3.2k
平均合并
20 小时 36 分钟
30 天内合并 PR
1

描述

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} )
```

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。