From 1821922d496302670955bf0a7f2b5f079b5c1597 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zolt=C3=A1n=20Mizsei?= <zmizsei@extrowerk.com>
Date: Tue, 2 Jul 2019 20:11:32 +0200
Subject: Install fixes


diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6fcdd95..ddd681a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -6,6 +6,8 @@ project(QuaZip)
 # and producing a warning when unset since 3.7.1)
 cmake_policy(SET CMP0042 NEW)
 
+include(GNUInstallDirs)
+
 option(BUILD_WITH_QT4 "Build QuaZip with Qt4 no matter if Qt5 was found" OFF)
 
 if( NOT BUILD_WITH_QT4 )
@@ -54,10 +56,10 @@ endif(UNIX OR MINGW)
 set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR})
 
 set(LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)")
-set(LIB_DESTINATION "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}" CACHE STRING "Library directory name" FORCE)
+set(LIB_DESTINATION "${CMAKE_INSTALL_LIBDIR}" CACHE STRING "Library directory name" FORCE)
 set(QUAZIP_LIB_TARGET_NAME quazip${QUAZIP_LIB_VERSION_SUFFIX} CACHE
     INTERNAL "Target name of libquazip" FORCE)
 
 add_subdirectory(quazip)
 
-install(FILES FindQuaZip.cmake RENAME FindQuaZip${QUAZIP_LIB_VERSION_SUFFIX}.cmake DESTINATION share/cmake/Modules)
+install(FILES FindQuaZip.cmake RENAME FindQuaZip${QUAZIP_LIB_VERSION_SUFFIX}.cmake DESTINATION ${INSTALL_PATH}/cmake/Modules)
diff --git a/quazip/CMakeLists.txt b/quazip/CMakeLists.txt
index abcdcf7..3355b61 100644
--- a/quazip/CMakeLists.txt
+++ b/quazip/CMakeLists.txt
@@ -28,5 +28,5 @@ set_target_properties(${QUAZIP_LIB_TARGET_NAME} quazip_static PROPERTIES VERSION
 target_link_libraries(${QUAZIP_LIB_TARGET_NAME} ${QT_QTMAIN_LIBRARY} ${QTCORE_LIBRARIES} ${ZLIB_LIBRARIES})
 target_link_libraries(quazip_static ${QT_QTMAIN_LIBRARY} ${QTCORE_LIBRARIES} ${ZLIB_LIBRARIES})
 
-install(FILES ${PUBLIC_HEADERS} DESTINATION include/quazip${QUAZIP_LIB_VERSION_SUFFIX})
+install(FILES ${PUBLIC_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/quazip${QUAZIP_LIB_VERSION_SUFFIX})
 install(TARGETS ${QUAZIP_LIB_TARGET_NAME} quazip_static LIBRARY DESTINATION ${LIB_DESTINATION} ARCHIVE DESTINATION ${LIB_DESTINATION} RUNTIME DESTINATION ${LIB_DESTINATION})
-- 
2.21.0


From 163358c80f825c9954386f8ae02db3f3a18d83dd Mon Sep 17 00:00:00 2001
From: begasus <begasus@gmail.com>
Date: Sat, 6 Jul 2019 08:28:35 +0200
Subject: Add pkgconfig support to cmake


diff --git a/CMakeLists.txt b/CMakeLists.txt
index ddd681a..00d812c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -57,6 +57,7 @@ set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR})
 
 set(LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)")
 set(LIB_DESTINATION "${CMAKE_INSTALL_LIBDIR}" CACHE STRING "Library directory name" FORCE)
+set(INSTALL_PKGCONFIG_DIR "${CMAKE_INSTALL_LIBDIR}/pkgconfig" CACHE STRING "Installation directory for pkgconfig (.pc) files" FORCE)
 set(QUAZIP_LIB_TARGET_NAME quazip${QUAZIP_LIB_VERSION_SUFFIX} CACHE
     INTERNAL "Target name of libquazip" FORCE)
 
diff --git a/quazip.pc.cmakein b/quazip.pc.cmakein
new file mode 100644
index 0000000..d342568
--- /dev/null
+++ b/quazip.pc.cmakein
@@ -0,0 +1,12 @@
+prefix=@CMAKE_INSTALL_PREFIX@
+exec_prefix=${prefix}
+libdir=@CMAKE_INSTALL_LIBDIR@
+includedir=@CMAKE_INSTALL_INCLUDEDIR@/quazip@QUAZIP_LIB_VERSION_SUFFIX@
+
+
+Name: Quazip
+Description: Quazip Library
+Version: @QUAZIP_LIB_VERSION@
+Libs: -L${libdir} -lquazip5
+Cflags: -I${includedir}/quazip@QUAZIP_LIB_VERSION_SUFFIX@
+Requires: Qt5Core
diff --git a/quazip/CMakeLists.txt b/quazip/CMakeLists.txt
index 3355b61..f99ae84 100644
--- a/quazip/CMakeLists.txt
+++ b/quazip/CMakeLists.txt
@@ -8,6 +8,9 @@ include_directories(
 file(GLOB SRCS "*.c" "*.cpp")
 file(GLOB PUBLIC_HEADERS "*.h")
 
+set(QUAZIP_LIB_VERSION 1.0.0)
+set(QUAZIP_LIB_SOVERSION 1)
+
 # Must be added to enable export macro
 ADD_DEFINITIONS(-DQUAZIP_BUILD)
 
@@ -23,10 +26,15 @@ if (NOT WIN32)
 	set_target_properties(quazip_static PROPERTIES OUTPUT_NAME quazip${QUAZIP_LIB_VERSION_SUFFIX})
 endif ()
 
-set_target_properties(${QUAZIP_LIB_TARGET_NAME} quazip_static PROPERTIES VERSION 1.0.0 SOVERSION 1 DEBUG_POSTFIX d)
+set_target_properties(${QUAZIP_LIB_TARGET_NAME} quazip_static PROPERTIES VERSION ${QUAZIP_LIB_VERSION} SOVERSION ${QUAZIP_LIB_SOVERSION} DEBUG_POSTFIX d)
 # Link against ZLIB_LIBRARIES if needed (on Windows this variable is empty)
 target_link_libraries(${QUAZIP_LIB_TARGET_NAME} ${QT_QTMAIN_LIBRARY} ${QTCORE_LIBRARIES} ${ZLIB_LIBRARIES})
 target_link_libraries(quazip_static ${QT_QTMAIN_LIBRARY} ${QTCORE_LIBRARIES} ${ZLIB_LIBRARIES})
 
+if(UNIX AND NOT APPLE)
+	configure_file( ${CMAKE_SOURCE_DIR}/quazip.pc.cmakein
+			${CMAKE_BINARY_DIR}/quazip.pc @ONLY)
+	install(FILES ${CMAKE_BINARY_DIR}/quazip.pc DESTINATION "${INSTALL_PKGCONFIG_DIR}")
+endif()
 install(FILES ${PUBLIC_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/quazip${QUAZIP_LIB_VERSION_SUFFIX})
 install(TARGETS ${QUAZIP_LIB_TARGET_NAME} quazip_static LIBRARY DESTINATION ${LIB_DESTINATION} ARCHIVE DESTINATION ${LIB_DESTINATION} RUNTIME DESTINATION ${LIB_DESTINATION})
-- 
2.21.0
