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:
+31
-11
@@ -31,18 +31,9 @@ MESSAGE(STATUS "CMAKE_INSTALL_LIBDIR: ${CMAKE_INSTALL_LIBDIR}")
|
||||
#-----------------------------------------------------------------------------
|
||||
# Options
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
# Legacy support
|
||||
OPTION(ZSTD_LEGACY_SUPPORT "LEGACY SUPPORT" OFF)
|
||||
IF (UNIX)
|
||||
OPTION(ZSTD_MULTITHREAD_SUPPORT "MULTITHREADING SUPPORT" ON)
|
||||
ELSE (UNIX)
|
||||
OPTION(ZSTD_MULTITHREAD_SUPPORT "MULTITHREADING SUPPORT" OFF)
|
||||
ENDIF (UNIX)
|
||||
OPTION(ZSTD_BUILD_PROGRAMS "BUILD PROGRAMS" ON)
|
||||
OPTION(ZSTD_BUILD_CONTRIB "BUILD CONTRIB" OFF)
|
||||
OPTION(ZSTD_BUILD_TESTS "BUILD TESTS" OFF)
|
||||
if (MSVC)
|
||||
OPTION(ZSTD_USE_STATIC_RUNTIME "LINK TO STATIC RUN-TIME LIBRARIES" OFF)
|
||||
endif ()
|
||||
|
||||
IF (ZSTD_LEGACY_SUPPORT)
|
||||
MESSAGE(STATUS "ZSTD_LEGACY_SUPPORT defined!")
|
||||
@@ -52,6 +43,35 @@ ELSE (ZSTD_LEGACY_SUPPORT)
|
||||
ADD_DEFINITIONS(-DZSTD_LEGACY_SUPPORT=0)
|
||||
ENDIF (ZSTD_LEGACY_SUPPORT)
|
||||
|
||||
# Multi-threading support
|
||||
OPTION(ZSTD_MULTITHREAD_SUPPORT "MULTITHREADING SUPPORT" ON)
|
||||
|
||||
IF (ZSTD_MULTITHREAD_SUPPORT)
|
||||
MESSAGE(STATUS "ZSTD_MULTITHREAD_SUPPORT is enabled")
|
||||
ELSE (ZSTD_MULTITHREAD_SUPPORT)
|
||||
MESSAGE(STATUS "ZSTD_MULTITHREAD_SUPPORT is disabled")
|
||||
ENDIF (ZSTD_MULTITHREAD_SUPPORT)
|
||||
|
||||
OPTION(ZSTD_BUILD_PROGRAMS "BUILD PROGRAMS" ON)
|
||||
OPTION(ZSTD_BUILD_CONTRIB "BUILD CONTRIB" OFF)
|
||||
OPTION(ZSTD_BUILD_TESTS "BUILD TESTS" OFF)
|
||||
if (MSVC)
|
||||
OPTION(ZSTD_USE_STATIC_RUNTIME "LINK TO STATIC RUN-TIME LIBRARIES" OFF)
|
||||
endif ()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# External dependencies
|
||||
#-----------------------------------------------------------------------------
|
||||
IF (ZSTD_MULTITHREAD_SUPPORT AND UNIX)
|
||||
SET(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||
FIND_PACKAGE(Threads REQUIRED)
|
||||
IF(CMAKE_USE_PTHREADS_INIT)
|
||||
SET(THREADS_LIBS "${CMAKE_THREAD_LIBS_INIT}")
|
||||
ELSE()
|
||||
MESSAGE(SEND_ERROR "ZSTD currently does not support thread libraries other than pthreads")
|
||||
ENDIF()
|
||||
ENDIF (ZSTD_MULTITHREAD_SUPPORT AND UNIX)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Add source directories
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user