Skip to content

Commit

Permalink
Add patch to fix linking fontconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
jwillikers committed Apr 11, 2024
1 parent abf0240 commit 98b6c07
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 0 deletions.
1 change: 1 addition & 0 deletions recipes/fltk/all/conandata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ sources:
patches:
"1.4.0":
- patch_file: "patches/1.4.0-0001-CMake-Improve-detection-of-the-GLU-library-and-GL-gl.patch"
- patch_file: "patches/1.4.0-0002-Use-find_package-for-Fontconfig.patch"
"1.3.9":
- patch_file: "patches/1.3.8-0001-remove-fluid.patch"
- patch_file: "patches/1.3.8-0003-build-static-only-on-static.patch"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
From f9684464d5dc45161b7ee3fee5ce41e3cd506d7b Mon Sep 17 00:00:00 2001
From: Jordan Williams <[email protected]>
Date: Thu, 11 Apr 2024 08:06:51 -0500
Subject: [PATCH] Use find_package for Fontconfig

---
CMake/options.cmake | 2 +-
CMake/resources.cmake | 4 ++--
CMake/variables.cmake | 6 +++---
src/CMakeLists.txt | 6 +++---
4 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/CMake/options.cmake b/CMake/options.cmake
index c4ba98914..e7414487f 100644
--- a/CMake/options.cmake
+++ b/CMake/options.cmake
@@ -951,7 +951,7 @@ if(FLTK_USE_XFT)
list(APPEND FLTK_LDLIBS -lXft)
set(FLTK_XFT_FOUND TRUE)
if(APPLE AND FLTK_BACKEND_X11)
- find_library(LIB_fontconfig fontconfig "/opt/X11/lib")
+ find_package(Fontconfig)
endif()
else()
set(FLTK_XFT_FOUND FALSE)
diff --git a/CMake/resources.cmake b/CMake/resources.cmake
index e5d6f8c9f..657514db3 100644
--- a/CMake/resources.cmake
+++ b/CMake/resources.cmake
@@ -147,7 +147,7 @@ mark_as_advanced(FREETYPE_PATH)
# libraries
find_library(LIB_dl dl)
if((NOT APPLE) OR FLTK_BACKEND_X11)
- find_library(LIB_fontconfig fontconfig)
+ find_package(Fontconfig)
endif((NOT APPLE) OR FLTK_BACKEND_X11)
find_library(LIB_freetype freetype)
find_library(LIB_GL GL)
@@ -158,7 +158,7 @@ find_library(LIB_png png)
find_library(LIB_zlib z)
find_library(LIB_m m)

-mark_as_advanced(LIB_dl LIB_fontconfig LIB_freetype)
+mark_as_advanced(LIB_dl LIB_freetype)
mark_as_advanced(LIB_GL LIB_MesaGL LIB_GLEW)
mark_as_advanced(LIB_jpeg LIB_png LIB_zlib)
mark_as_advanced(LIB_m)
diff --git a/CMake/variables.cmake b/CMake/variables.cmake
index cbf6ffdf3..dbcb65a45 100644
--- a/CMake/variables.cmake
+++ b/CMake/variables.cmake
@@ -53,9 +53,9 @@ else()
list(APPEND FLTK_LDLIBS -lm)
endif(WIN32)

-if(LIB_fontconfig)
- list(APPEND FLTK_LDLIBS -lfontconfig)
-endif(LIB_fontconfig)
+if(Fontconfig_FOUND)
+ list(APPEND FLTK_LDLIBS Fontconfig::Fontconfig)
+endif()

# add "-ldl" or whatever is necessary according to CMake (CMAKE_DL_LIBS)
if(HAVE_DLSYM)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index e283f0ce4..facfb9f72 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -685,9 +685,9 @@ endif(USE_PANGO)

if(USE_XFT)
list(APPEND OPTIONAL_LIBS ${X11_Xft_LIB})
- if(LIB_fontconfig)
- list(APPEND OPTIONAL_LIBS ${LIB_fontconfig})
- endif(LIB_fontconfig)
+ if(Fontconfig_FOUND)
+ list(APPEND OPTIONAL_LIBS Fontconfig::Fontconfig)
+ endif()
endif(USE_XFT)

if(UNIX AND FLTK_BACKEND_WAYLAND)
--
2.44.0

0 comments on commit 98b6c07

Please sign in to comment.