mirror of
https://github.com/facebook/zstd.git
synced 2025-07-28 00:01:53 +03:00
- Split monolithic 235-line CMakeLists.txt into focused modules - Main file reduced to 78 lines with clear section organization - Created 5 specialized modules: * ZstdVersion.cmake - CMake policies and version management * ZstdOptions.cmake - Build options and platform configuration * ZstdDependencies.cmake - External dependency management * ZstdBuild.cmake - Build targets and validation * ZstdPackage.cmake - Package configuration generation Benefits: - Improved readability and maintainability - Better separation of concerns - Easier debugging and modification - Preserved 100% backward compatibility - All existing build options and targets unchanged The refactored build system passes all tests and maintains identical functionality while being much easier to understand and maintain.
31 lines
1002 B
CMake
31 lines
1002 B
CMake
# ################################################################
|
|
# ZSTD Dependencies Configuration
|
|
# ################################################################
|
|
|
|
# Function to handle HP-UX thread configuration
|
|
function(setup_hpux_threads)
|
|
find_package(Threads)
|
|
if(NOT Threads_FOUND)
|
|
set(CMAKE_USE_PTHREADS_INIT 1 PARENT_SCOPE)
|
|
set(CMAKE_THREAD_LIBS_INIT -lpthread PARENT_SCOPE)
|
|
set(CMAKE_HAVE_THREADS_LIBRARY 1 PARENT_SCOPE)
|
|
set(Threads_FOUND TRUE PARENT_SCOPE)
|
|
endif()
|
|
endfunction()
|
|
|
|
# Configure threading support
|
|
if(ZSTD_MULTITHREAD_SUPPORT AND UNIX)
|
|
if(CMAKE_SYSTEM_NAME MATCHES "HP-UX")
|
|
setup_hpux_threads()
|
|
else()
|
|
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
|
find_package(Threads REQUIRED)
|
|
endif()
|
|
|
|
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()
|