You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
PackageKit-Qt/0012-Use-GNUInstallDirs-to-...

127 lines
4.2 KiB

From 97306279fa6b5eed72187125895b313b0b51a386 Mon Sep 17 00:00:00 2001
From: Hrvoje Senjan <hrvoje.senjan@gmail.com>
Date: Fri, 19 Sep 2014 00:17:36 +0200
Subject: [PATCH 12/16] Use GNUInstallDirs to determine most of used variables
Also removed unused vars
---
CMakeLists.txt | 17 +++--------------
config.h.in | 7 -------
src/CMakeLists.txt | 4 ++--
src/packagekitqt4.pc.in | 4 ++--
src/packagekitqt5.pc.in | 4 ++--
5 files changed, 9 insertions(+), 27 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b1e1e97..1c77b82 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -6,6 +6,9 @@ find_package(PkgConfig REQUIRED)
set(CMAKE_BUILD_TYPE "Debug")
+# Used to set installation paths
+include(GNUInstallDirs)
+
set(QPACKAGEKIT_VERSION_MAJOR "0")
set(QPACKAGEKIT_VERSION_MINOR "9")
set(QPACKAGEKIT_VERSION_PATCH "3")
@@ -41,28 +44,14 @@ endif(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
#
# Configure files
#
-set (CMAKE_INSTALL_LIBDIR "lib/${CMAKE_LIBRARY_ARCHITECTURE}" CACHE PATH "Output directory for libraries")
-set (PREFIXDIR "${CMAKE_INSTALL_PREFIX}")
-set (DATADIR "${CMAKE_INSTALL_PREFIX}/share")
-set (PKGDATADIR "${DATA_INSTALL_DIR}")
-set (LIBDIR "${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}")
-set (PKGLIBDIR "${LIBDIR}/packagekit")
set (GETTEXT_PACKAGE "packagekit")
-set (LOCALE_DIR "${DATADIR}/locale")
set (VERSION "${QPACKAGEKIT_VERSION}")
-set (BUILDDIR "${CMAKE_BINARY_DIR}")
set (LOCALSTATEDIR "/var")
set (CMAKECONFIG_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/${LIBNAME}/")
add_definitions("-DLOCALSTATEDIR=\"${LOCALSTATEDIR}\"")
add_definitions("-std=gnu++11")
-if (IS_ABSOLUTE ${CMAKE_INSTALL_LIBDIR})
- set (PKQT_INSTALL_LIBDIR ${CMAKE_INSTALL_LIBDIR})
-else (IS_ABSOLUTE ${CMAKE_INSTALL_LIBDIR})
- set (PKQT_INSTALL_LIBDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
-endif (IS_ABSOLUTE ${CMAKE_INSTALL_LIBDIR})
-
configure_file(config.h.in ${CMAKE_BINARY_DIR}/config.h)
#
diff --git a/config.h.in b/config.h.in
index 782abcb..7985f30 100644
--- a/config.h.in
+++ b/config.h.in
@@ -8,13 +8,6 @@
#define GETTEXT_PACKAGE "@GETTEXT_PACKAGE@"
/* Paths */
-#define LOCALEDIR "@LOCALE_DIR@"
-#define PKGDATADIR "@PKGDATADIR@"
-#define PKGLIBDIR "@PKGLIBDIR@"
-#define PREFIXDIR "@PREFIXDIR@"
-#define DATADIR "@DATADIR@"
-#define LIBDIR "@LIBDIR@"
-#define BUILDDIR "@BUILDDIR@"
/* Name of package */
#define PACKAGE_NAME "packagekit-qt"
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index c52e1b1..c6e16bd 100755
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -101,13 +101,13 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${LIBNAME}.pc.in
${CMAKE_CURRENT_BINARY_DIR}/${LIBNAME}.pc
@ONLY
)
-target_include_directories(${LIBNAME} INTERFACE "$<INSTALL_INTERFACE:include/${LIBNAME}/PackageKit/;include/${LIBNAME}>")
+target_include_directories(${LIBNAME} INTERFACE "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/${LIBNAME}/PackageKit/;${CMAKE_INSTALL_INCLUDEDIR}/${LIBNAME}>")
install(TARGETS ${LIBNAME} EXPORT PackageKitQtTargets DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${LIBNAME}.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
)
install(FILES ${packagekitqt_HEADERS}
- DESTINATION include/${LIBNAME}/PackageKit/
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${LIBNAME}/PackageKit/
)
add_subdirectory(modules)
diff --git a/src/packagekitqt4.pc.in b/src/packagekitqt4.pc.in
index 449bbe2..013e5a0 100755
--- a/src/packagekitqt4.pc.in
+++ b/src/packagekitqt4.pc.in
@@ -1,7 +1,7 @@
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=${prefix}
-libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
-includedir=${prefix}/include
+libdir=@CMAKE_INSTALL_FULL_LIBDIR@
+includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
Name: @LIBNAME@
Description: PackageKit is a system daemon for installing stuff.
diff --git a/src/packagekitqt5.pc.in b/src/packagekitqt5.pc.in
index 0b2f476..da6c2a9 100644
--- a/src/packagekitqt5.pc.in
+++ b/src/packagekitqt5.pc.in
@@ -1,7 +1,7 @@
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=${prefix}
-libdir=@PKQT_INSTALL_LIBDIR@
-includedir=${prefix}/include
+libdir=@CMAKE_INSTALL_FULL_LIBDIR@
+includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
Name: @LIBNAME@
Description: PackageKit is a system daemon for installing stuff.
--
2.1.0