diff options
| author | Rohan Garg <rohan16garg@gmail.com> | 2014-09-03 14:28:14 +0200 | 
|---|---|---|
| committer | Rohan Garg <rohan16garg@gmail.com> | 2014-09-03 14:28:14 +0200 | 
| commit | 96e7fb9969b761cce956a3500ede3b1c6cb29c65 (patch) | |
| tree | 0db7e79e5523cdaf22bb9d95124d99042a5ff667 | |
| parent | 5d6171f4c3a3f87e4e7114131304028b8b54941b (diff) | |
| download | extra-cmake-modules-96e7fb9969b761cce956a3500ede3b1c6cb29c65.tar.gz extra-cmake-modules-96e7fb9969b761cce956a3500ede3b1c6cb29c65.tar.bz2 | |
Fix ECM to use qmake instead of hardcoding plugin install dirs
Packagers and other interested folks should pass -DKDE_INSTALL_USE_QT_SYS_PATHS=ON
when building in order to install various files to the same dir as the Qt5 install
dirs.
CCMAIL: kde-packagers@kde.org
REVIEW: 119901
| -rw-r--r-- | kde-modules/KDEInstallDirs.cmake | 42 | ||||
| -rw-r--r-- | modules/ECMGeneratePriFile.cmake | 8 | ||||
| -rw-r--r-- | modules/ECMQueryQmake.cmake | 15 | 
3 files changed, 49 insertions, 16 deletions
| diff --git a/kde-modules/KDEInstallDirs.cmake b/kde-modules/KDEInstallDirs.cmake index 880539b7..54eb49cc 100644 --- a/kde-modules/KDEInstallDirs.cmake +++ b/kde-modules/KDEInstallDirs.cmake @@ -162,11 +162,6 @@  # (To distribute this file outside of extra-cmake-modules, substitute the full  #  License text for the above reference.) - -# TODO: -# - Try to figure out proper Qt-related dirs when installing to the same -#   prefix as Qt (look for qtpaths) -  # Figure out what the default install directory for libraries should be.  # This is based on the logic in GNUInstallDirs, but simplified (the  # GNUInstallDirs code deals with re-configuring, but that is dealt with @@ -199,7 +194,6 @@ if((CMAKE_SYSTEM_NAME MATCHES "Linux|kFreeBSD" OR CMAKE_SYSTEM_NAME STREQUAL "GN    endif()  endif() -  # Macro for variables that are relative to another variable. We store an empty  # value in the cache (for documentation/GUI cache editor purposes), and store  # the default value in a local variable. If the cache variable is ever set to @@ -287,7 +281,6 @@ macro(_define_absolute varname dir docstring)      _define_relative("${varname}" "" "${dir}" "${docstring}" ${ARGN})  endmacro() -  if(APPLE)      _define_absolute(BUNDLEDIR "/Applications/KDE"          "application bundles" @@ -328,22 +321,41 @@ _define_relative(CMAKEPACKAGEDIR LIBDIR "cmake"      "CMake packages, including config files"      CMAKECONFIG_INSTALL_PREFIX) +option (KDE_INSTALL_USE_QT_SYS_PATHS "Install mkspecs files, Plugins and Imports to the Qt 5 install dir") +if(KDE_INSTALL_USE_QT_SYS_PATHS)  # Qt-specific vars -_define_relative(QTPLUGINDIR LIBDIR "plugins" -    "Qt plugins" -    QT_PLUGIN_INSTALL_DIR) +    include(ECMQueryQmake) + +    query_qmake(qt_plugins_dir QT_INSTALL_PLUGINS) + +    _define_absolute(QTPLUGINDIR ${qt_plugins_dir} +        "Qt plugins" +         QT_PLUGIN_INSTALL_DIR) + +    query_qmake(qt_imports_dir QT_INSTALL_IMPORTS) + +    _define_absolute(QTQUICKIMPORTSDIR QTPLUGINDIR ${qt_imports_dir} +        "QtQuick1 imports" +        IMPORTS_INSTALL_DIR) + +else() +    _define_relative(QTPLUGINDIR LIBDIR "plugins" +        "Qt plugins" +        QT_PLUGIN_INSTALL_DIR) + +    _define_relative(QTQUICKIMPORTSDIR QTPLUGINDIR "imports" +        "QtQuick1 imports" +        IMPORTS_INSTALL_DIR) +endif() +  _define_relative(PLUGINDIR QTPLUGINDIR ""      "Plugins"      PLUGIN_INSTALL_DIR) -_define_relative(QTQUICKIMPORTSDIR QTPLUGINDIR "imports" -    "QtQuick1 imports" -    IMPORTS_INSTALL_DIR) +  _define_relative(QMLDIR LIBDIR "qml"      "QtQuick2 imports"      QML_INSTALL_DIR) - -  _define_absolute(INCLUDEDIR "include"      "C and C++ header files"      INCLUDE_INSTALL_DIR) diff --git a/modules/ECMGeneratePriFile.cmake b/modules/ECMGeneratePriFile.cmake index 34001d6c..53cd69db 100644 --- a/modules/ECMGeneratePriFile.cmake +++ b/modules/ECMGeneratePriFile.cmake @@ -82,7 +82,13 @@  # (To distribute this file outside of extra-cmake-modules, substitute the full  #  License text for the above reference.) -set(ECM_MKSPECS_INSTALL_DIR mkspecs/modules CACHE PATH "The directory where mkspecs will be installed to.") +if(KDE_ECM_INSTALL_TO_QT_SYS_DIR) +  include(ECMQueryQmake) +  query_qmake(qt_host_data_dir QT_HOST_DATA) +  set(ECM_MKSPECS_INSTALL_DIR ${qt_host_data_dir}/mkspecs/modules CACHE PATH "The directory where mkspecs will be installed to.") +else () +  set(ECM_MKSPECS_INSTALL_DIR mkspecs/modules CACHE PATH "The directory where mkspecs will be installed to.") +endif()  function(ECM_GENERATE_PRI_FILE)    set(options ) diff --git a/modules/ECMQueryQmake.cmake b/modules/ECMQueryQmake.cmake new file mode 100644 index 00000000..5147fcc7 --- /dev/null +++ b/modules/ECMQueryQmake.cmake @@ -0,0 +1,15 @@ +find_package(Qt5Core QUIET) + +if (TARGET Qt5::qmake) +  get_target_property(QMAKE_EXECUTABLE Qt5::qmake LOCATION) +else() +  set(QMAKE_EXECUTABLE "qmake-qt5" CACHE) +endif() + +function(QUERY_QMAKE RESULT VAR) +    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() +endfunction(QUERY_QMAKE) | 
