From: Xavier Mitault Date: Wed, 18 Oct 2023 11:22:15 +0000 (+0200) Subject: Add doc on how to use it with cmake FetchContent X-Git-Tag: v1.5.6^2~110^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e590c8a0e3b2ecdde5f63d385fa7f9bd759721d3;p=thirdparty%2Fzstd.git Add doc on how to use it with cmake FetchContent --- diff --git a/build/cmake/README.md b/build/cmake/README.md index a460dd161..022e61688 100644 --- a/build/cmake/README.md +++ b/build/cmake/README.md @@ -41,6 +41,31 @@ cmake -DZSTD_BUILD_TESTS=ON -DZSTD_LEGACY_SUPPORT=OFF .. make ``` +### how to use it with CMake FetchContent + +For all options available, you can see it on +```cmake +include(FetchContent) + +set(ZSTD_BUILD_STATIC ON) +set(ZSTD_BUILD_SHARED OFF) + +FetchContent_Declare( + zstd + URL "https://github.com/facebook/zstd/releases/download/v1.5.5/zstd-1.5.5.tar.gz" + DOWNLOAD_EXTRACT_TIMESTAMP TRUE + SOURCE_SUBDIR build/cmake +) + +FetchContent_MakeAvailable(zstd) + +target_link_libraries( + ${PROJECT_NAME} + PRIVATE + libzstd_static +) +``` + ### referring [Looking for a 'cmake clean' command to clear up CMake output](https://stackoverflow.com/questions/9680420/looking-for-a-cmake-clean-command-to-clear-up-cmake-output)