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