Files
cuber/deps/Findhttplib.cmake
T
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

94 lines
2.9 KiB
CMake

# ==============================================================================
# Find httplib
# ==============================================================================
# This module fetches the cpp-httplib HTTP library.
#
# Targets provided:
# httplib::httplib - The httplib library target
#
# Variables set:
# httplib_FOUND - TRUE if httplib is available
# httplib_LIBRARIES - The httplib library target (httplib::httplib)
# httplib_INCLUDE_DIR - Include directories for httplib
# httplib_VERSION - Version of httplib
# ==============================================================================
if (DEFINED _FINDHTTPLIB_INCLUDED)
return()
endif()
set(_FINDHTTPLIB_INCLUDED TRUE)
message(STATUS "Fetching httplib")
include(FetchContent)
# Choose fetch method depending on git availability
find_program(GIT_EXECUTABLE git)
if (GIT_EXECUTABLE)
set(HTTPLIB_FETCH_METHOD "GIT")
else()
set(HTTPLIB_FETCH_METHOD "ZIP")
endif()
# Disable optional compression dependencies
set(HTTPLIB_USE_ZSTD_IF_AVAILABLE OFF CACHE BOOL "" FORCE)
set(HTTPLIB_USE_BROTLI_IF_AVAILABLE OFF CACHE BOOL "" FORCE)
if (HTTPLIB_FETCH_METHOD STREQUAL "GIT")
FetchContent_Declare(
httplib
GIT_REPOSITORY https://github.com/yhirose/cpp-httplib.git
GIT_TAG v0.28.0
)
else()
# GitHub release ZIP for v0.28.0
FetchContent_Declare(
httplib
URL https://github.com/yhirose/cpp-httplib/archive/refs/tags/v0.28.0.zip
)
endif()
FetchContent_MakeAvailable(httplib)
set(httplib_FOUND TRUE)
set(httplib_VERSION "0.28.0")
# Ensure we have a usable target
if (NOT TARGET httplib::httplib)
if (TARGET httplib)
add_library(httplib::httplib ALIAS httplib)
else()
# As a last resort, create a header-only INTERFACE target around httplib.h
message(STATUS "No 'httplib' or 'httplib::httplib' target exists. Creating a header-only target manually.")
add_library(httplib INTERFACE)
add_library(httplib::httplib ALIAS httplib)
# Try to infer the include directory (where httplib.h lives)
if (DEFINED httplib_SOURCE_DIR)
target_include_directories(httplib INTERFACE "${httplib_SOURCE_DIR}")
elseif (DEFINED HTTPLIB_SOURCE_DIR)
target_include_directories(httplib INTERFACE "${HTTPLIB_SOURCE_DIR}")
endif()
endif()
endif()
set(httplib_FOUND TRUE)
set(httplib_LIBRARIES httplib::httplib)
get_target_property(_httplib_inc httplib::httplib INTERFACE_INCLUDE_DIRECTORIES)
if (_httplib_inc)
set(httplib_INCLUDE_DIR "${_httplib_inc}")
endif()
# Mark httplib includes as SYSTEM to suppress warnings from its headers
if (_httplib_inc AND TARGET httplib)
set_target_properties(httplib PROPERTIES
INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${_httplib_inc}"
)
endif()
set(HTTPLIB_LICENSE_FILE "${httplib_SOURCE_DIR}/LICENSE" CACHE FILEPATH "Path to httplib license file")
message(STATUS "httplib version: ${httplib_VERSION}")