File 0001-Add-configure_file-and-pkg-config-template.patch of Package libredfish

From 0f4e0130f9bfafc4cc637745e1bbe105f8287fb0 Mon Sep 17 00:00:00 2001
From: Thomas Renninger <trenn@suse.com>
Date: Wed, 24 Jan 2024 11:40:11 +0100
Subject: [PATCH 1/4] Add configure_file and pkg-config template

This will generate a libredfish.pc file that can/should be placed to
(in openSUSE at least):
/usr/lib64/pkgconfig
So that Linux systems making use of pkg-config are aware of libredfish
library

Signed-off-by:  <trenn@suse.com>
---
 CMakeLists.txt   |  2 ++
 libredfish.pc.in | 19 +++++++++++++++++++
 2 files changed, 21 insertions(+)
 create mode 100644 libredfish.pc.in

diff --git a/CMakeLists.txt b/CMakeLists.txt
index c7c7196..71dcf46 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -123,3 +123,5 @@ elseif(MSVC)
         set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LIBPATH:.. /LIBPATH:../curl/lib")
     endif()
 endif()
+
+configure_file(libredfish.pc.in libredfish.pc @ONLY)
diff --git a/libredfish.pc.in b/libredfish.pc.in
new file mode 100644
index 0000000..0690f26
--- /dev/null
+++ b/libredfish.pc.in
@@ -0,0 +1,19 @@
+# this template is filled-in by CMake `configure_file(... @ONLY)`
+# the `@....@` are filled in by CMake configure_file(), 
+# from variables set in your CMakeLists.txt or by CMake itself
+#
+# Good tutoral for understanding .pc files: 
+# https://people.freedesktop.org/~dbn/pkg-config-guide.html
+
+prefix="@CMAKE_INSTALL_PREFIX@"
+exec_prefix="@CMAKE_INSTALL_BINDIR@
+libdir="@CMAKE_INSTALL_LIBDIR@"
+includedir="@INCLUDE_INSTALL_DIR@"
+
+Name: @PROJECT_NAME@
+Description: Redfish library
+URL: https://github.com/DMTF/libredfish
+Version: @LIBREDFISH_VERSION_STRING@
+Requires: @pc_req_public@
+Cflags: -I"${includedir}"
+Libs: -L"${libdir}" -lredfish
-- 
2.43.0

openSUSE Build Service is sponsored by