facebook / facebook/zstd

Building libzstd as part of larger cmake project using add_directory(zstd/build/cmake) does not work

Open
#3,758 1 comment 1 reaction 0 assignees View on GitHub
build help wanted
Dominant language
C
Stars
27.9k
Forks
2.6k
Avg merge
1d 3h
Merged PRs (30d)
8

Description

**Describe the bug**
The cmake file under build/cmake/ is missing these under static and shared library creation which prevent the inclusion
libzstd_static or libzstd_shared targets into another project that uses libzstd. By adding these lines (marked with +):
```
if (ZSTD_BUILD_STATIC)
add_library(libzstd_static STATIC ${Sources} ${Headers})
+ target_include_directories(libzstd_static
+ PUBLIC $
+ INTERFACE $
)
```
the project using libzstd_static can find header files when the new project linked with zstdlib using in
target_link_libraries(${TEST_APP} PRIVATE libzstd_static)

Same fix is also required for ZSTD_BUILD_SHARED.
Without this fix, during the build, the project depending on libzstd will not compile because it cannot find libzstd headers.

Found out when cross compiling mcap library for custom linux and mcap is using zstdlib 1.4.7 and cmake 3.22.1 in Ubuntu 22.04

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.