diff options
Diffstat (limited to 'CMakeModules')
| -rw-r--r-- | CMakeModules/Findstb.cmake | 31 |
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 | |||
| 5 | find_path(stb_image_INCLUDE_DIR stb_image.h PATH_SUFFIXES stb) | ||
| 6 | find_path(stb_image_resize_INCLUDE_DIR stb_image_resize.h PATH_SUFFIXES stb) | ||
| 7 | find_path(stb_image_write_INCLUDE_DIR stb_image_write.h PATH_SUFFIXES stb) | ||
| 8 | |||
| 9 | include(FindPackageHandleStandardArgs) | ||
| 10 | find_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 | |||
| 17 | if (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 | ) | ||
| 25 | endif() | ||
| 26 | |||
| 27 | mark_as_advanced( | ||
| 28 | stb_image_INCLUDE_DIR | ||
| 29 | stb_image_resize_INCLUDE_DIR | ||
| 30 | stb_image_write_INCLUDE_DIR | ||
| 31 | ) | ||