]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
pzstd: fix linking for static builds 2724/head
authorJonathan Ringer <jonringer117@gmail.com>
Fri, 9 Jul 2021 20:21:15 +0000 (13:21 -0700)
committerJonathan Ringer <jonringer117@gmail.com>
Fri, 9 Jul 2021 20:21:15 +0000 (13:21 -0700)
build/cmake/contrib/pzstd/CMakeLists.txt

index 5c30a91b1392f64c44261106db131c3addb02aa4..27af86c88dd1694078477d2611e640af462c368f 100644 (file)
@@ -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()