Files
cuber/deps/Findzlib.cmake
portersky 90d013695d feat: add OpenGL abstraction layer with RAII resources
- Replace window class with cbt::opengl::context
- Add buffer resource (VBO, EBO, UBO, SSBO) with move semantics
- Add texture resource with format/type enums and filtering
- Add descriptor_set for Vulkan-style resource binding
- All resources use RAII with proper cleanup
2026-05-05 21:58:34 +02:00

54 lines
1.6 KiB
CMake

# ==============================================================================
# Findzlib.cmake
# ==============================================================================
# This module fetches and builds the zlib compression library.
# https://github.com/madler/zlib
#
# Targets provided:
# ZLIB::ZLIBSTATIC - Static library target
#
# Variables set:
# zlib_FOUND - TRUE if zlib is available
# zlib_LIBRARIES - The library target (ZLIB::ZLIBSTATIC)
# zlib_INCLUDE_DIR - Include directories for zlib
# ==============================================================================
if (DEFINED _FINDZLIB_INCLUDED)
return()
endif()
set(_FINDZLIB_INCLUDED TRUE)
if (DEFINED zlib_FIND_VERSION AND NOT zlib_FIND_VERSION STREQUAL "")
set(ZLIB_TAG "v${zlib_FIND_VERSION}")
else()
set(ZLIB_TAG "v1.3.2")
endif()
message(STATUS "Fetching zlib @ ${ZLIB_TAG}")
include(FetchContent)
find_program(GIT_EXECUTABLE git)
if (NOT GIT_EXECUTABLE)
message(FATAL_ERROR "Fetch with zip not supported.")
endif()
FetchContent_Declare(
zlib
GIT_REPOSITORY https://github.com/madler/zlib.git
GIT_TAG ${ZLIB_TAG}
GIT_SHALLOW TRUE
EXCLUDE_FROM_ALL
)
set(ZLIB_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(zlib)
# zlib's CMakeLists provides ZLIB::ZLIBSTATIC for the static build
set(zlib_FOUND TRUE)
set(zlib_LIBRARIES ZLIB::ZLIBSTATIC)
set(zlib_INCLUDE_DIR "${zlib_SOURCE_DIR};${zlib_BINARY_DIR}")
set(ZLIB_LICENSE_FILE "${zlib_SOURCE_DIR}/LICENSE" CACHE FILEPATH "Path to zlib license file")