Skip to content

Commit

Permalink
add a FindStb.cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
jube committed Jan 7, 2024
1 parent cfe7f6f commit 157cc83
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ find_package(ZLIB REQUIRED)

find_package(Threads REQUIRED)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")

if(GF_USE_EMBEDDED_LIBS)
message(STATUS "Build with embedded libraries")
set(Stb_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/library/vendor/stb")
Expand Down
29 changes: 29 additions & 0 deletions cmake/FindStb.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Distributed under the OSI-approved BSD 3-Clause License.

#.rst:
# FindStb
# ------------
#
# Find the Stb include headers.
#
# Result Variables
# ^^^^^^^^^^^^^^^^
#
# This module defines the following variables:
#
# ``Stb_FOUND``
# True if Stb library found
#
# ``Stb_INCLUDE_DIR``
# Location of Stb headers
#

include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake)
include(${CMAKE_ROOT}/Modules/SelectLibraryConfigurations.cmake)

if(NOT Stb_INCLUDE_DIR)
find_path(Stb_INCLUDE_DIR NAMES stb_image.h PATHS ${Stb_DIR} PATH_SUFFIXES include)
endif()

find_package_handle_standard_args(Stb DEFAULT_MSG Stb_INCLUDE_DIR)
mark_as_advanced(Stb_INCLUDE_DIR)

0 comments on commit 157cc83

Please sign in to comment.