facebook / facebook/zstd

Make CMake official? (Makefile build does not provide CMake config file)

Open
#3,271 24 comments 5 reactions 1 assignee Claimed by @Cyan4973 View on GitHub
Dominant language
C
Stars
27.9k
Forks
2.6k
Avg merge
1d 3h
Merged PRs (30d)
8

Description

README.md says

> make is the officially maintained build system of this project.

When using Makefile, CMake config files like `zstdConfig.cmake` is not installed. This makes projects using CMake awkward to use zstd. E.g. llvm-project has

```cmake
// https://github.com/llvm/llvm-project/blob/main/llvm/cmake/config-ix.cmake
if(LLVM_ENABLE_ZSTD)
if(LLVM_ENABLE_ZSTD STREQUAL FORCE_ON)
find_package(zstd REQUIRED)
if(NOT zstd_FOUND)
message(FATAL_ERROR "Failed to configure zstd, but LLVM_ENABLE_ZSTD is FORCE_ON")
endif()
elseif(NOT LLVM_USE_SANITIZER MATCHES "Memory.*")
find_package(zstd QUIET)
endif()
endif()
set(LLVM_ENABLE_ZSTD ${zstd_FOUND})

// https://github.com/llvm/llvm-project/blob/main/llvm/lib/Support/CMakeLists.txt#L28
if(LLVM_ENABLE_ZSTD)
if(TARGET zstd::libzstd_shared AND NOT LLVM_USE_STATIC_ZSTD)
set(zstd_target zstd::libzstd_shared)
else()
set(zstd_target zstd::libzstd_static)
endif()
endif()
```

It could add pkg-config fallback but that is inconvenient, and logic like `zstd::libzstd_shared` does not have a good replacement.

Related:

* https://bugs.gentoo.org/872254
* https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1020403

The simplest solution is to make CMake official so downstream is motivated to switch to CMake.

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.