Skip to content

Commit

Permalink
Merge pull request #2724 from jonringer/fix-pzstd-static-build
Browse files Browse the repository at this point in the history
pzstd: fix linking for static builds
  • Loading branch information
terrelln authored Jul 28, 2021
2 parents d69e007 + e1f85db commit 32cfe15
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion build/cmake/contrib/pzstd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,16 @@ add_executable(pzstd ${PROGRAMS_DIR}/util.c ${PZSTD_DIR}/main.cpp ${PZSTD_DIR}/O
set_property(TARGET pzstd APPEND PROPERTY COMPILE_DEFINITIONS "NDEBUG")
set_property(TARGET pzstd APPEND PROPERTY COMPILE_OPTIONS "-Wno-shadow")

if (ZSTD_BUILD_SHARED)
set(ZSTD_LIB libzstd_shared)
else()
set(ZSTD_LIB libzstd_static)
endif()

set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
if (CMAKE_USE_PTHREADS_INIT)
target_link_libraries(pzstd libzstd_shared ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(pzstd ${ZSTD_LIB} ${CMAKE_THREAD_LIBS_INIT})
else()
message(SEND_ERROR "ZSTD currently does not support thread libraries other than pthreads")
endif()
Expand Down

0 comments on commit 32cfe15

Please sign in to comment.