facebook / facebook/zstd

Support using zstd as cmake subdirectory - proper include directory

Đang mở
#2,377 1 bình luận 1 reaction 0 người được giao Xem trên GitHub
build feature request help wanted
Ngôn ngữ chính
C
Star
27.9k
Fork
2.6k
Merge trung bình
1 ngày 3 giờ
Pull request đã merge (30 ngày)
8

Mô tả

**Is your feature request related to a problem? Please describe.**
I use zstd as git submodule and cmake subdirectory. This introduces necessary cmake target `libzstd_static`. This target does not provide include directory. I need to do workaround:
```
add_subdirectory(zstd-submodule/build/cmake)
target_include_directories(libzstd_static PUBLIC zstd-submodule/lib/) # this shouldn't be necessary
```

**Describe the solution you'd like**
Add following last line (or equivalent):
```
if (ZSTD_BUILD_STATIC)
add_library(libzstd_static STATIC ${Sources} ${Headers})
list(APPEND library_targets libzstd_static)
target_include_directories(libzstd_static PUBLIC ../../../lib)
```
Ditto for shared

Bonus points for moving all includes to `lib/includes/zstd` and adding `lib/includes` as include directory. Then I would include as `#include ` as I do with most libraries that don't want to interfere with one another or don't pretend to be provided by system. As it is now, different library behaving just like zstd can have it's own `common/cpu.h`. If I use both libraries, includes will interfere. That is why it should be differentiated by `#include

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.