diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-21 11:54:28 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-21 11:54:28 +0000 |
commit | e6918187568dbd01842d8d1d2c808ce16a894239 (patch) | |
tree | 64f88b554b444a49f656b6c656111a145cbbaa28 /cmake/modules/BuildZstd.cmake | |
parent | Initial commit. (diff) | |
download | ceph-b26c4052f3542036551aa9dec9caa4226e456195.tar.xz ceph-b26c4052f3542036551aa9dec9caa4226e456195.zip |
Adding upstream version 18.2.2.upstream/18.2.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'cmake/modules/BuildZstd.cmake')
-rw-r--r-- | cmake/modules/BuildZstd.cmake | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/cmake/modules/BuildZstd.cmake b/cmake/modules/BuildZstd.cmake new file mode 100644 index 000000000..799b14b28 --- /dev/null +++ b/cmake/modules/BuildZstd.cmake @@ -0,0 +1,22 @@ +# libzstd - build it statically +function(build_Zstd) + set(ZSTD_C_FLAGS "-fPIC -Wno-unused-variable -O3") + + include(ExternalProject) + ExternalProject_Add(zstd_ext + SOURCE_DIR ${CMAKE_SOURCE_DIR}/src/zstd/build/cmake + CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} + -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} + -DCMAKE_C_FLAGS=${ZSTD_C_FLAGS} + -DCMAKE_AR=${CMAKE_AR} + -DCMAKE_POSITION_INDEPENDENT_CODE=${ENABLE_SHARED} + BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/libzstd + BUILD_COMMAND ${CMAKE_COMMAND} --build <BINARY_DIR> --target libzstd_static + BUILD_BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/libzstd/lib/libzstd.a" + INSTALL_COMMAND "") + add_library(Zstd::Zstd STATIC IMPORTED) + set_target_properties(Zstd::Zstd PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_SOURCE_DIR}/src/zstd/lib" + IMPORTED_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/libzstd/lib/libzstd.a") + add_dependencies(Zstd::Zstd zstd_ext) +endfunction() |