summaryrefslogtreecommitdiff
path: root/CMakeModules/Findstb.cmake
diff options
context:
space:
mode:
authorGravatar liamwhite2023-10-25 17:21:37 -0400
committerGravatar GitHub2023-10-25 17:21:37 -0400
commit43be2bfe332d5537041262eb08037993239eaf5f (patch)
tree65ad2049b7ce6b0464069d23058a25fc4c457fff /CMakeModules/Findstb.cmake
parentMerge pull request #11876 from liamwhite/apiversion (diff)
parentcmake: prefer system stb headers (diff)
downloadyuzu-43be2bfe332d5537041262eb08037993239eaf5f.tar.gz
yuzu-43be2bfe332d5537041262eb08037993239eaf5f.tar.xz
yuzu-43be2bfe332d5537041262eb08037993239eaf5f.zip
Merge pull request #11880 from abouvier/unbundle-stb
cmake: prefer system stb headers
Diffstat (limited to 'CMakeModules/Findstb.cmake')
-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 @@
1# SPDX-FileCopyrightText: 2023 Alexandre Bouvier <contact@amb.tf>
2#
3# SPDX-License-Identifier: GPL-3.0-or-later
4
5find_path(stb_image_INCLUDE_DIR stb_image.h PATH_SUFFIXES stb)
6find_path(stb_image_resize_INCLUDE_DIR stb_image_resize.h PATH_SUFFIXES stb)
7find_path(stb_image_write_INCLUDE_DIR stb_image_write.h PATH_SUFFIXES stb)
8
9include(FindPackageHandleStandardArgs)
10find_package_handle_standard_args(stb
11 REQUIRED_VARS
12 stb_image_INCLUDE_DIR
13 stb_image_resize_INCLUDE_DIR
14 stb_image_write_INCLUDE_DIR
15)
16
17if (stb_FOUND AND NOT TARGET stb::headers)
18 add_library(stb::headers INTERFACE IMPORTED)
19 set_property(TARGET stb::headers PROPERTY
20 INTERFACE_INCLUDE_DIRECTORIES
21 "${stb_image_INCLUDE_DIR}"
22 "${stb_image_resize_INCLUDE_DIR}"
23 "${stb_image_write_INCLUDE_DIR}"
24 )
25endif()
26
27mark_as_advanced(
28 stb_image_INCLUDE_DIR
29 stb_image_resize_INCLUDE_DIR
30 stb_image_write_INCLUDE_DIR
31)