aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/ECMGeneratePriFile.cmake8
-rw-r--r--modules/ECMQueryQmake.cmake15
2 files changed, 22 insertions, 1 deletions
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)