Blame 0006-Use-ECM-to-locate-the-correct-install-paths-on-a-Qt5.patch

Rex Dieter e5f144
From 3b78e9d35c0acf8899be91ca4af4fdd4f7fcff92 Mon Sep 17 00:00:00 2001
Rex Dieter e5f144
From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= <mgraesslin@kde.org>
Rex Dieter e5f144
Date: Sat, 24 May 2014 09:56:12 +0200
Rex Dieter e5f144
Subject: [PATCH 6/9] Use ECM to locate the correct install paths on a Qt5
Rex Dieter e5f144
 build
Rex Dieter e5f144
Rex Dieter e5f144
Main motivation is installing the library to a proper multi-arch location
Rex Dieter e5f144
on debian based systems.
Rex Dieter e5f144
Rex Dieter e5f144
REVIEW: 118291
Rex Dieter e5f144
---
Rex Dieter e5f144
 CMakeLists.txt            |  4 ++++
Rex Dieter e5f144
 lib/prison/CMakeLists.txt | 17 ++++++++++++++---
Rex Dieter e5f144
 2 files changed, 18 insertions(+), 3 deletions(-)
Rex Dieter e5f144
Rex Dieter e5f144
diff --git a/CMakeLists.txt b/CMakeLists.txt
Rex Dieter e5f144
index 68ad2fe..11c0643 100644
Rex Dieter e5f144
--- a/CMakeLists.txt
Rex Dieter e5f144
+++ b/CMakeLists.txt
Rex Dieter e5f144
@@ -18,6 +18,10 @@ include_directories(${CMAKE_SOURCE_DIR}/lib ${QT_INCLUDES} ${CMAKE_CURRENT_BINAR
Rex Dieter e5f144
 
Rex Dieter e5f144
 #### Qt 4 and 5 ####
Rex Dieter e5f144
 if(QT5_BUILD)
Rex Dieter e5f144
+  find_package(ECM 0.0.13 REQUIRED NO_MODULE)
Rex Dieter e5f144
+  set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
Rex Dieter e5f144
+  include(KDEInstallDirs)
Rex Dieter e5f144
+
Rex Dieter e5f144
   find_package(Qt5Core REQUIRED)
Rex Dieter e5f144
   find_package(Qt5Gui REQUIRED)
Rex Dieter e5f144
   find_package(Qt5Widgets REQUIRED)
Rex Dieter e5f144
diff --git a/lib/prison/CMakeLists.txt b/lib/prison/CMakeLists.txt
Rex Dieter e5f144
index c9458e1..6560db6 100644
Rex Dieter e5f144
--- a/lib/prison/CMakeLists.txt
Rex Dieter e5f144
+++ b/lib/prison/CMakeLists.txt
Rex Dieter e5f144
@@ -46,7 +46,11 @@ if (CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32)
Rex Dieter e5f144
     endif (_HAVE_GCC_VISIBILITY)
Rex Dieter e5f144
 endif (CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32)
Rex Dieter e5f144
 
Rex Dieter e5f144
-install( TARGETS prison DESTINATION ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX} )
Rex Dieter e5f144
+if(QT5_BUILD)
Rex Dieter e5f144
+  install(TARGETS prison ${KF5_INSTALL_TARGETS_DEFAULT_ARGS})
Rex Dieter e5f144
+else()
Rex Dieter e5f144
+  install( TARGETS prison DESTINATION ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX} )
Rex Dieter e5f144
+endif()
Rex Dieter e5f144
 
Rex Dieter e5f144
 install( FILES
Rex Dieter e5f144
          abstractbarcode.h
Rex Dieter e5f144
@@ -70,7 +74,14 @@ install( FILES
Rex Dieter e5f144
 set(INCLUDE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/include)
Rex Dieter e5f144
 get_target_property(LIB_OUT_NAME prison LOCATION)
Rex Dieter e5f144
 get_filename_component(LIB_OUT_NAME ${LIB_OUT_NAME} NAME)
Rex Dieter e5f144
-set(LIBPATH ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX})
Rex Dieter e5f144
+
Rex Dieter e5f144
+if(QT5_BUILD)
Rex Dieter e5f144
+  set(LIBPATH ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR})
Rex Dieter e5f144
+  set(CMAKECONFIG_INSTALL_DIR "${CMAKECONFIG_INSTALL_PREFIX}/Prison")
Rex Dieter e5f144
+else()
Rex Dieter e5f144
+  set(LIBPATH ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX})
Rex Dieter e5f144
+  set(CMAKECONFIG_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/cmake/Prison")
Rex Dieter e5f144
+endif()
Rex Dieter e5f144
 
Rex Dieter e5f144
 configure_file(
Rex Dieter e5f144
    PrisonConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/PrisonConfig.cmake @ONLY
Rex Dieter e5f144
@@ -86,7 +97,7 @@ write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/PrisonConfigVersion
Rex Dieter e5f144
 install( FILES
Rex Dieter e5f144
          ${CMAKE_CURRENT_BINARY_DIR}/PrisonConfig.cmake
Rex Dieter e5f144
          ${CMAKE_CURRENT_BINARY_DIR}/PrisonConfigVersion.cmake
Rex Dieter e5f144
-	 DESTINATION ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/cmake/Prison
Rex Dieter e5f144
+	 DESTINATION ${CMAKECONFIG_INSTALL_DIR}
Rex Dieter e5f144
 )
Rex Dieter e5f144
 
Rex Dieter e5f144
 
Rex Dieter e5f144
-- 
Rex Dieter e5f144
2.5.0
Rex Dieter e5f144