From 5a0551df0a563ac3e3ecc06913030194ecfa6b94 Mon Sep 17 00:00:00 2001
From: Albrecht Schlosser <albrechts.fltk@online.de>
Date: Mon, 27 Jan 2025 15:51:34 +0100
Subject: [PATCH] CMake: fix include directories of bundled image libs

If FLTK has been built with bundled image libs the include directory
of the *installed* library headers is 'FL/images' relative to the
normal 'include' directory.

The CMake property "include_directories" is now added to the installed
fltk_images library so it is used when building user programs with
bundled image libs.
---
 src/CMakeLists.txt | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index c5180ba3f..1cb57df34 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -847,7 +847,19 @@ target_link_libraries(fltk_images PRIVATE ${FLTK_IMAGE_LIBRARIES})
 if(FLTK_USE_BUNDLED_JPEG)
   target_include_directories(fltk_images PUBLIC
     $<BUILD_INTERFACE:${FLTK_SOURCE_DIR}/jpeg>
-    $<INSTALL_INTERFACE:include>)
+    $<INSTALL_INTERFACE:include/FL/images>)
+endif()
+
+if(FLTK_USE_BUNDLED_PNG)
+  target_include_directories(fltk_images PUBLIC
+    $<BUILD_INTERFACE:${FLTK_SOURCE_DIR}/png>
+    $<INSTALL_INTERFACE:include/FL/images>)
+endif()
+
+if(FLTK_USE_BUNDLED_ZLIB)
+  target_include_directories(fltk_images PUBLIC
+    $<BUILD_INTERFACE:${FLTK_SOURCE_DIR}/zlib>
+    $<INSTALL_INTERFACE:include/FL/images>)
 endif()
 
 #######################################################################
-- 
GitLab