From b0599699bc9a147efc0d00e5e7ac6e8abdd3a3b0 Mon Sep 17 00:00:00 2001
From: Rohit Goswami <rog32@hi.is>
Date: Fri, 31 May 2024 14:15:51 +0000
Subject: [PATCH] BLD: Add a pkgconfig file

---
 CMakeLists.txt       | 6 ++++++
 xtensor-python.pc.in | 7 +++++++
 2 files changed, 13 insertions(+)
 create mode 100644 xtensor-python.pc.in

diff --git a/CMakeLists.txt b/CMakeLists.txt
index b17b005..9c84002 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -124,6 +124,12 @@ export(EXPORT ${PROJECT_NAME}-targets
 install(FILES ${XTENSOR_PYTHON_HEADERS}
         DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/xtensor-python)
 
+configure_file(${PROJECT_NAME}.pc.in
+               "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc"
+                @ONLY)
+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc"
+        DESTINATION "${CMAKE_INSTALL_DATADIR}/pkgconfig/")
+
 set(XTENSOR_PYTHON_CMAKECONFIG_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}" CACHE
     STRING "install path for xtensor-pythonConfig.cmake")
 
diff --git a/xtensor-python.pc.in b/xtensor-python.pc.in
new file mode 100644
index 0000000..c198795
--- /dev/null
+++ b/xtensor-python.pc.in
@@ -0,0 +1,7 @@
+prefix=@CMAKE_INSTALL_PREFIX@
+includedir=${prefix}/include
+
+Name: xtensor-python
+Description: An extension to the xtensor library, offering Python bindings with enhanced NumPy support.
+Version: @xtensor-python_VERSION@
+Cflags: -I${includedir}