# ============================================================================== # Find stb # ============================================================================== # This module fetches the stb single-file public domain libraries # (stb_image_write.h for PNG writing, etc.). # # Targets provided: # stb::stb - Interface library (add #define STB_IMAGE_WRITE_IMPLEMENTATION # in exactly one .cpp before including "stb_image_write.h") # # Variables set: # stb_FOUND - TRUE if stb is available # stb_INCLUDE_DIR - Include directories for stb # stb_VERSION - Version of stb (commit) # ============================================================================== if (DEFINED _FINDSTB_INCLUDED) return() endif() set(_FINDSTB_INCLUDED TRUE) # Pin to a recent stable commit set(STB_VERSION "master") message(STATUS "Fetching stb ${STB_VERSION}") include(FetchContent) FetchContent_Declare( stb GIT_REPOSITORY https://github.com/nothings/stb.git GIT_TAG ${STB_VERSION} ) FetchContent_MakeAvailable(stb) add_library(stb INTERFACE) target_include_directories(stb INTERFACE "${stb_SOURCE_DIR}") add_library(stb::stb ALIAS stb) set(stb_FOUND TRUE) set(stb_INCLUDE_DIR "${stb_SOURCE_DIR}") set(stb_VERSION "${STB_VERSION}") # Mark as SYSTEM includes set_target_properties(stb PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${stb_SOURCE_DIR}" )