Asset refactor
This commit is contained in:
31
cmake/modules/Findstb.cmake
Normal file
31
cmake/modules/Findstb.cmake
Normal file
@@ -0,0 +1,31 @@
|
||||
# Copyright (c) 2026 Dominic Masters
|
||||
#
|
||||
# This software is released under the MIT License.
|
||||
# https://opensource.org/licenses/MIT
|
||||
|
||||
include(FetchContent)
|
||||
FetchContent_Declare(
|
||||
stb
|
||||
GIT_REPOSITORY https://github.com/nothings/stb.git
|
||||
)
|
||||
|
||||
# Fetch stb if not already done
|
||||
FetchContent_MakeAvailable(stb)
|
||||
|
||||
# Find the stb_image.h header
|
||||
set(STB_INCLUDE_DIR "${stb_SOURCE_DIR}")
|
||||
set(STB_IMAGE_HEADER "${stb_SOURCE_DIR}/stb_image.h")
|
||||
|
||||
if(EXISTS "${STB_IMAGE_HEADER}")
|
||||
add_library(stb_image INTERFACE)
|
||||
target_include_directories(stb_image INTERFACE "${STB_INCLUDE_DIR}")
|
||||
set(STB_IMAGE_FOUND TRUE)
|
||||
else()
|
||||
set(STB_IMAGE_FOUND FALSE)
|
||||
endif()
|
||||
|
||||
# Standard CMake variables
|
||||
set(STB_IMAGE_INCLUDE_DIRS "${STB_INCLUDE_DIR}")
|
||||
set(STB_IMAGE_LIBRARIES stb_image)
|
||||
|
||||
mark_as_advanced(STB_IMAGE_INCLUDE_DIRS STB_IMAGE_LIBRARIES STB_IMAGE_FOUND)
|
||||
Reference in New Issue
Block a user