pzstd: fix linking for static builds
parent
b3e372c171
commit
e1f85dbca3
|
@ -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_DEFINITIONS "NDEBUG")
|
||||||
set_property(TARGET pzstd APPEND PROPERTY COMPILE_OPTIONS "-Wno-shadow")
|
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)
|
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||||
find_package(Threads REQUIRED)
|
find_package(Threads REQUIRED)
|
||||||
if (CMAKE_USE_PTHREADS_INIT)
|
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()
|
else()
|
||||||
message(SEND_ERROR "ZSTD currently does not support thread libraries other than pthreads")
|
message(SEND_ERROR "ZSTD currently does not support thread libraries other than pthreads")
|
||||||
endif()
|
endif()
|
||||||
|
|
Loading…
Reference in New Issue