From 943340222e841904707dc4f3e08f0df57d2e5c28 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Fri, 26 Jun 2020 20:45:11 +0200 Subject: CMake: Generate qdevice.pri when cross-building This adds the CMake equivalent to the classical -device-option key=value configure argument: -DQT_QMAKE_DEVICE_OPTIONS=key1=value1[;keyN=valueN] The keys and values get dumped verbatim into qdevice.pri. This patch also ports the machineTuple configure test. Its result is written into qdevice.pri as value for the GCC_MACHINE_DUMP variable. Change-Id: I29f2323fd87639fafaed99ec7446c7ee75504705 Reviewed-by: Alexandru Croitor --- cmake/QtBuild.cmake | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'cmake/QtBuild.cmake') diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake index daa98d9498..4ddb61aec3 100644 --- a/cmake/QtBuild.cmake +++ b/cmake/QtBuild.cmake @@ -1244,6 +1244,28 @@ QT_PATCH_VERSION = ${PROJECT_VERSION_PATCH} qt_install(FILES "${qconfig_pri_target_path}" DESTINATION ${INSTALL_MKSPECSDIR}) endfunction() +# Creates mkspecs/qdevice.pri which contains target device information for cross-builds. +# The content of QT_QMAKE_DEVICE_OPTIONS is written verbatim into qdevice.pri. +function(qt_generate_global_device_pri_file) + if(NOT CMAKE_CROSSCOMPILING) + return() + endif() + + qt_path_join(qdevice_pri_target_path ${PROJECT_BINARY_DIR} ${INSTALL_MKSPECSDIR} "qdevice.pri") + + set(content "") + foreach(opt ${QT_QMAKE_DEVICE_OPTIONS}) + string(APPEND content "${opt}\n") + endforeach() + + if(TEST_machine_tuple) + string(APPEND content "GCC_MACHINE_DUMP = ${TEST_machine_tuple}\n") + endif() + + file(GENERATE OUTPUT "${qdevice_pri_target_path}" CONTENT "${content}") + qt_install(FILES "${qdevice_pri_target_path}" DESTINATION ${INSTALL_MKSPECSDIR}) +endfunction() + function(qt_get_build_parts out_var) set(parts "libs") -- cgit v1.2.3