[PATCH 6/9] When building against Qt5, use qmake to detect Qt installation paths.

Jon Severinsson jon at severinsson.net
Sat Oct 6 19:15:48 BST 2012


This is done by FindQt4.cmake, but not FindQt5*.cmake, so for Qt5 we have to do it ourselves.
---
 CMakeLists.txt |   17 +++++++++++++++++
 1 fil ändrad, 17 tillägg(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index ed09836..c9ab5d2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -74,6 +74,23 @@ set(BUILDSYSTEM_INSTALL_DIR ${SHARE_INSTALL_PREFIX}/phonon/buildsystem/)
 option(PHONON_INSTALL_QT_EXTENSIONS_INTO_SYSTEM_QT "Install Qt designer plugins, QML plugins and mkspecs into the system Qt install directory or not"
        FALSE)
 
+# The Qt5 cmake files don't provide it's install paths, so ask qmake.
+if(QT5_BUILD)
+  get_target_property(QMAKE_EXECUTABLE Qt5::qmake LOCATION)
+  function(QUERY_QMAKE VAR RESULT)
+    exec_program(${QMAKE_EXECUTABLE} ARGS "-query ${VAR}" RETURN_VALUE return_code OUTPUT_VARIABLE output )
+    if(NOT return_code)
+      file(TO_CMAKE_PATH "${output}" output)
+      set(${RESULT} ${output} PARENT_SCOPE)
+    endif(NOT return_code)
+  endfunction(QUERY_QMAKE)
+
+  query_qmake(QT_INSTALL_PLUGINS QT_PLUGINS_DIR)
+  query_qmake(QT_INSTALL_IMPORTS QT_IMPORTS_DIR)
+  query_qmake(QT_HOST_DATA QT_DATA_DIR)
+  set(QT_MKSPECS_DIR ${QT_DATA_DIR}/mkspecs)
+endif(QT5_BUILD)
+
 if(PHONON_INSTALL_QT_EXTENSIONS_INTO_SYSTEM_QT)
     # in this case, the values have to be FORCED into the cache
     set(PHONON_QT_IMPORTS_INSTALL_DIR ${QT_IMPORTS_DIR} CACHE PATH "The directory where Phonon Qt imports (QML) will be installed to." FORCE)
-- 
1.7.10.4

_______________________________________________
Kde-frameworks-devel mailing list
Kde-frameworks-devel at kde.org
https://mail.kde.org/mailman/listinfo/kde-frameworks-devel


More information about the kde-multimedia mailing list