From dd76e8fcf2a2d7e122110444695ad20f2549420e Mon Sep 17 00:00:00 2001
From: Mike Frysinger <vapier@gentoo.org>
Date: Wed, 10 Jan 2018 01:56:10 -0500
Subject: [PATCH] generate & install gdlib.pc for cmake builds too #164

---
 config/gdlib.pc.cmake | 9 +++++++++
 src/CMakeLists.txt    | 3 +++
 2 files changed, 12 insertions(+)
 create mode 100644 config/gdlib.pc.cmake

diff --git a/config/gdlib.pc.cmake b/config/gdlib.pc.cmake
new file mode 100644
index 00000000..fb828882
--- /dev/null
+++ b/config/gdlib.pc.cmake
@@ -0,0 +1,11 @@
+prefix=@CMAKE_INSTALL_PREFIX@
+exec_prefix=@CMAKE_INSTALL_PREFIX@
+libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@
+includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
+
+Name: gd
+Description: GD graphics library
+Version: @GDLIB_VERSION@
+Cflags: -I${includedir}
+Libs.private: @LIBGD_DEP_LIBS@
+Libs: -L${libdir} -lgd
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index a621fe1e..38fc9c42 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -174,3 +174,6 @@ install(FILES
 	gdfontt.h
 	gdfx.h
 	DESTINATION include)
+
+CONFIGURE_FILE(../config/gdlib.pc.cmake gdlib.pc @ONLY)
+INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/gdlib.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
