Hi,

Since I had no answer for now about my previous email, I'll assume the 
major version number to be the API/ABI compatibility number. With that, 
here is a patch to generate and install a pkg-config file for libpodofo.

Please, note that the .pc file will only be created for system where 
pkg-config is available. I could have restricted it only to the OS, but 
than again pkg-config can be installed on mostly any OS. On the other 
hand, .pc file could be created and installed in all cases, so if 
wanted, this condition could be removed.

-- 
Alexandre Demers

Index: src/CMakeLists.txt
===================================================================
--- src/CMakeLists.txt  (revision 1775)
+++ src/CMakeLists.txt  (working copy)
@@ -308,6 +308,24 @@
          LIBRARY DESTINATION "${LIBDIRNAME}"
          ARCHIVE DESTINATION "${LIBDIRNAME}"
          )
+
+    # Create a pkg-config file for linking against shared library
+    # if pkg-config is available on the system.
+    # Add a version to the file name corresponding to the API compatibility.
+
+    FIND_PROGRAM(PKG_CONFIG_FOUND pkg-config)
+    IF(PKG_CONFIG_FOUND)
+        MESSAGE("Pkg-config found, creating a pkg-config file for linking 
against shared library.")
+        CONFIGURE_FILE(
+            "libpodofo.pc.in"
+            "${PoDoFo_BINARY_DIR}/libpodofo-${PODOFO_VERSION_MAJOR}.pc"
+            @ONLY)
+        INSTALL(
+            FILES "${PoDoFo_BINARY_DIR}/libpodofo-${PODOFO_VERSION_MAJOR}.pc"
+            DESTINATION "${LIBDIRNAME}/pkgconfig")
+    ELSE(PKG_CONFIG_FOUND)
+        MESSAGE("Pkg-config not found. No pkg-config file will be created.")
+    ENDIF(PKG_CONFIG_FOUND)
  ENDIF(PODOFO_BUILD_SHARED)
  
  # Use these flags when compiling code that includes PoDoFo headers.
Index: src/libpodofo.pc.in
===================================================================
--- src/libpodofo.pc.in (nonexistent)
+++ src/libpodofo.pc.in (working copy)
@@ -0,0 +1,10 @@
+prefix=@CMAKE_INSTALL_PREFIX@
+exec_prefix=${prefix}
+libdir=${exec_prefix}/@LIBDIRNAME@
+includedir=${prefix}/include/podofo
+
+Name: @CMAKE_PROJECT_NAME@
+Description: A C++ library to work with the PDF file format
+Version: @PODOFO_VERSION@
+Libs: -L${libdir} -lpodofo-@PODOFO_VERSION_MAJOR@
+Cflags: -I${includedir}


------------------------------------------------------------------------------
_______________________________________________
Podofo-users mailing list
Podofo-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/podofo-users

Reply via email to