diff --git a/cmake/QtQmakeHelpers.cmake b/cmake/QtQmakeHelpers.cmake index cf15ada7b38..30db68170fc 100644 --- a/cmake/QtQmakeHelpers.cmake +++ b/cmake/QtQmakeHelpers.cmake @@ -92,6 +92,23 @@ function(qt_generate_qconfig_cpp) set(QT_CONFIGURE_HOSTBINDIR_TO_HOSTPREFIX_PATH "${from_bin_dir_to_prefix}") set(QT_CONFIGURE_HOSTBINDIR_TO_EXTPREFIX_PATH "${from_bin_dir_to_prefix}") + # Ensure Windows drive letter is prepended to the install prefix hardcoded + # into qconfig.cpp, otherwise qmake can't find Qt modules in a static Qt + # build if there's no qt.conf. Mostly relevant for CI. + # Given input like + # \work/qt/install + # or + # \work\qt\install + # Expected output is something like + # C:/work/qt/install + # so it includes a drive letter and forward slashes. + set(QT_CONFIGURE_PREFIX_PATH_STR "${QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX}") + if(WIN32) + get_filename_component( + QT_CONFIGURE_PREFIX_PATH_STR + "${QT_CONFIGURE_PREFIX_PATH_STR}" REALPATH) + endif() + configure_file(global/qconfig.cpp.in global/qconfig.cpp @ONLY) endfunction() diff --git a/src/corelib/global/qconfig.cpp.in b/src/corelib/global/qconfig.cpp.in index 664924abec6..19689e29097 100644 --- a/src/corelib/global/qconfig.cpp.in +++ b/src/corelib/global/qconfig.cpp.in @@ -1,7 +1,7 @@ /* Installation date */ static const char qt_configure_installation [12+11] = "qt_instdate=2012-12-20"; /* Installation Info */ -static const char qt_configure_prefix_path_str [12+256] = "qt_prfxpath=@QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX@"; +static const char qt_configure_prefix_path_str [12+256] = "qt_prfxpath=@QT_CONFIGURE_PREFIX_PATH_STR@"; #ifdef QT_BUILD_QMAKE static const char qt_configure_ext_prefix_path_str [12+256] = "qt_epfxpath=@QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX@"; static const char qt_configure_host_prefix_path_str [12+256] = "qt_hpfxpath=@QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX@";