summaryrefslogtreecommitdiffstats
path: root/CMakeModules
diff options
context:
space:
mode:
authorliamwhite <liamwhite@users.noreply.github.com>2023-10-25 23:21:37 +0200
committerGitHub <noreply@github.com>2023-10-25 23:21:37 +0200
commit43be2bfe332d5537041262eb08037993239eaf5f (patch)
tree65ad2049b7ce6b0464069d23058a25fc4c457fff /CMakeModules
parentMerge pull request #11876 from liamwhite/apiversion (diff)
parentcmake: prefer system stb headers (diff)
downloadyuzu-43be2bfe332d5537041262eb08037993239eaf5f.tar
yuzu-43be2bfe332d5537041262eb08037993239eaf5f.tar.gz
yuzu-43be2bfe332d5537041262eb08037993239eaf5f.tar.bz2
yuzu-43be2bfe332d5537041262eb08037993239eaf5f.tar.lz
yuzu-43be2bfe332d5537041262eb08037993239eaf5f.tar.xz
yuzu-43be2bfe332d5537041262eb08037993239eaf5f.tar.zst
yuzu-43be2bfe332d5537041262eb08037993239eaf5f.zip
Diffstat (limited to 'CMakeModules')
-rw-r--r--CMakeModules/Findstb.cmake31
1 files changed, 31 insertions, 0 deletions
diff --git a/CMakeModules/Findstb.cmake b/CMakeModules/Findstb.cmake
new file mode 100644
index 000000000..bff998580
--- /dev/null
+++ b/CMakeModules/Findstb.cmake
@@ -0,0 +1,31 @@
+# SPDX-FileCopyrightText: 2023 Alexandre Bouvier <contact@amb.tf>
+#
+# SPDX-License-Identifier: GPL-3.0-or-later
+
+find_path(stb_image_INCLUDE_DIR stb_image.h PATH_SUFFIXES stb)
+find_path(stb_image_resize_INCLUDE_DIR stb_image_resize.h PATH_SUFFIXES stb)
+find_path(stb_image_write_INCLUDE_DIR stb_image_write.h PATH_SUFFIXES stb)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(stb
+ REQUIRED_VARS
+ stb_image_INCLUDE_DIR
+ stb_image_resize_INCLUDE_DIR
+ stb_image_write_INCLUDE_DIR
+)
+
+if (stb_FOUND AND NOT TARGET stb::headers)
+ add_library(stb::headers INTERFACE IMPORTED)
+ set_property(TARGET stb::headers PROPERTY
+ INTERFACE_INCLUDE_DIRECTORIES
+ "${stb_image_INCLUDE_DIR}"
+ "${stb_image_resize_INCLUDE_DIR}"
+ "${stb_image_write_INCLUDE_DIR}"
+ )
+endif()
+
+mark_as_advanced(
+ stb_image_INCLUDE_DIR
+ stb_image_resize_INCLUDE_DIR
+ stb_image_write_INCLUDE_DIR
+)