mirror of
https://github.com/facebook/zstd.git
synced 2025-07-30 22:23:13 +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.
43 lines
1.1 KiB
CMake
43 lines
1.1 KiB
CMake
# ################################################################
|
|
# ZSTD Package Configuration
|
|
# ################################################################
|
|
|
|
include(CMakePackageConfigHelpers)
|
|
|
|
# Generate version file
|
|
write_basic_package_version_file(
|
|
"${CMAKE_CURRENT_BINARY_DIR}/zstdConfigVersion.cmake"
|
|
VERSION ${zstd_VERSION}
|
|
COMPATIBILITY SameMajorVersion
|
|
)
|
|
|
|
# Export targets for build directory
|
|
export(EXPORT zstdExports
|
|
FILE "${CMAKE_CURRENT_BINARY_DIR}/zstdTargets.cmake"
|
|
NAMESPACE zstd::
|
|
)
|
|
|
|
# Configure package for installation
|
|
set(ConfigPackageLocation ${CMAKE_INSTALL_LIBDIR}/cmake/zstd)
|
|
|
|
# Install exported targets
|
|
install(EXPORT zstdExports
|
|
FILE zstdTargets.cmake
|
|
NAMESPACE zstd::
|
|
DESTINATION ${ConfigPackageLocation}
|
|
)
|
|
|
|
# Configure and install package config file
|
|
configure_package_config_file(
|
|
zstdConfig.cmake.in
|
|
"${CMAKE_CURRENT_BINARY_DIR}/zstdConfig.cmake"
|
|
INSTALL_DESTINATION ${ConfigPackageLocation}
|
|
)
|
|
|
|
# Install config files
|
|
install(FILES
|
|
"${CMAKE_CURRENT_BINARY_DIR}/zstdConfig.cmake"
|
|
"${CMAKE_CURRENT_BINARY_DIR}/zstdConfigVersion.cmake"
|
|
DESTINATION ${ConfigPackageLocation}
|
|
)
|