CMake: fixed multithreading build on Windows

`ZSTD_MULTITHREAD_SUPPORT` option fixed for Windows.

Signed-off-by: Alexey Ivanov <alexey.ivanes@gmail.com>
This commit is contained in:
Alexey Ivanov
2018-01-17 10:27:52 +03:00
parent f0d703243f
commit 22303da601
3 changed files with 50 additions and 21 deletions
+12 -1
View File
@@ -24,7 +24,7 @@ INCLUDE_DIRECTORIES(${LIBRARY_DIR} ${LIBRARY_DIR}/common)
# Parse version
INCLUDE(GetZstdLibraryVersion)
GetZstdLibraryVersion(${LIBRARY_DIR}/zstd.h LIBVER_MAJOR LIBVER_MINOR LIBVER_RELEASE)
MESSAGE("ZSTD VERSION ${LIBVER_MAJOR}.${LIBVER_MINOR}.${LIBVER_RELEASE}")
MESSAGE(STATUS "ZSTD VERSION ${LIBVER_MAJOR}.${LIBVER_MINOR}.${LIBVER_RELEASE}")
SET(Sources
${LIBRARY_DIR}/common/entropy_common.c
@@ -120,6 +120,17 @@ IF (MSVC)
ENDIF (ZSTD_BUILD_STATIC)
ENDIF (MSVC)
# Add multi-threading support definitions
IF (ZSTD_MULTITHREAD_SUPPORT)
SET_PROPERTY(TARGET libzstd_shared libzstd_static APPEND PROPERTY COMPILE_DEFINITIONS "ZSTD_MULTITHREAD")
IF (UNIX)
TARGET_LINK_LIBRARIES(libzstd_shared ${THREADS_LIBS})
TARGET_LINK_LIBRARIES(libzstd_static ${THREADS_LIBS})
ENDIF ()
ENDIF (ZSTD_MULTITHREAD_SUPPORT)
# With MSVC static library needs to be renamed to avoid conflict with import library
IF (MSVC)
SET(STATIC_LIBRARY_BASE_NAME zstd_static)