libpng 1.6.35 creates incorrect pkg-config file on linux

Kyle Bentley <[email protected]> Fri, 23 Nov 2018 18:58:18 +0000
Newsgroups gmane.comp.graphics.png.devel
Message-ID <[email protected]>
Hello all,

I'd noticed a difference project I'm working on was not able to include libpng.so correctly when using the pkg_check_modules
function in cmake.  I think that the section in the CMakeLists.txt responsible for writing the pkg-config file should make use
of the GNUInstallDirs CMAKE_INSTALL_FULL_LIBDIR and CMAKE_INSTALL_FULL_INCLUDEDIR instead of appending the CMAKE_INSTALL_PREFIX
manually.  I made those cmall changes and pkg-config files were being generated correctly.  For convenience, the patch file is
included.

Thanks,

Kyle
This e-mail including any attachments may contain information that is privileged, confidential, and/or otherwise protected from disclosure to anyone other than its intended recipient(s). Any dissemination or use of this e-mail or its attachments by persons other than the intended recipient(s) is prohibited. If you received this message in error, please contact the sender immediately. Please then delete the e-mail and any attachments in its entirety.

_______________________________________________
png-mng-implement mailing list
png-mng-implement-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
libpng-1.6.35_pkgconfig.patch (text/x-patch, 972 B)
diff -Naur --no-dereference libpng-1.6.35/CMakeLists.txt libpng-1.6.35.1/CMakeLists.txt
--- libpng-1.6.35/CMakeLists.txt	2018-07-15 22:58:00.000000000 -0500
+++ libpng-1.6.35.1/CMakeLists.txt	2018-11-23 12:35:18.687088323 -0600
@@ -37,6 +37,7 @@
 set(PNGLIB_MAJOR 1)
 set(PNGLIB_MINOR 6)
 set(PNGLIB_RELEASE 35)
+set(PNGLIB_TWEAK 1)
 set(PNGLIB_NAME libpng${PNGLIB_MAJOR}${PNGLIB_MINOR})
 set(PNGLIB_VERSION ${PNGLIB_MAJOR}.${PNGLIB_MINOR}.${PNGLIB_RELEASE})
 
@@ -829,8 +830,8 @@
 if(NOT WIN32 OR CYGWIN OR MINGW)
   set(prefix      ${CMAKE_INSTALL_PREFIX})
   set(exec_prefix ${CMAKE_INSTALL_PREFIX})
-  set(libdir      ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR})
-  set(includedir  ${CMAKE_INSTALL_PREFIX}/include)
+  set(libdir      ${CMAKE_INSTALL_FULL_LIBDIR})
+  set(includedir  ${CMAKE_INSTALL_FULL_INCLUDEDIR})
   set(LIBS        "-lz -lm")
   configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng.pc.in
     ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}.pc @ONLY)