CMake: Fix qconfig.cpp embedded prefix in the CI
In the CI on a windows we configure Qt with the following prefix -DCMAKE_INSTALL_PREFIX:PATH=\Users\qt\work\install Note the lack of the drive letter. This is intentional, so that we can abuse CMake's DESTDIR installation mechanism to install into a custom path. This causes trouble for static Qt builds in the CI. Specifically when there is no qt.conf file next to qmake, qmake -query will report a QT_INSTALL_PREFIX:/Users/qt/work/install and ultimately qmake will fail to locate the module .pri files in such a path, showing errors like: Project ERROR: Unknown module(s) in QT: core gui? If a qt.conf is placed next to qmake (even an empty one), a differenct code path is used in qmake to resolve the prefix, which returns a path with a drive letter. In a shared build, because the 'relocatable' feature is enabled by default, a different code path is used and thus the prefix is also successfully resolved. So the problem is specific to static Windows Qt builds that have no qt.conf file next to qmake. This is the exact scenario that we encounter when running static Qt tests (tst_qmake in particular). To circumvent the issue, prepend a drive letter to the prefix hardcoded into qconfig.cpp. Do that with get_filename_component(REALPATH) which apparently resolves to a fully qualified path. Pick-to: 6.1 Task-number: QTBUG-87580 Change-Id: I17c885f29bfdee45bec1d6aac7c3b26723e761a3 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
parent
04df85bbec
commit
59c3be7117
@ -66,6 +66,23 @@ function(qt_generate_qconfig_cpp in_file out_file)
|
|||||||
"${lib_location_absolute_path}" "${QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX}")
|
"${lib_location_absolute_path}" "${QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX}")
|
||||||
set(QT_CONFIGURE_LIBLOCATION_TO_PREFIX_PATH "${from_lib_location_to_prefix}")
|
set(QT_CONFIGURE_LIBLOCATION_TO_PREFIX_PATH "${from_lib_location_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(${in_file} ${out_file} @ONLY)
|
configure_file(${in_file} ${out_file} @ONLY)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
/* Installation date */
|
/* Installation date */
|
||||||
static const char qt_configure_installation [12+11] = "qt_instdate=2012-12-20";
|
static const char qt_configure_installation [12+11] = "qt_instdate=2012-12-20";
|
||||||
/* Installation Info */
|
/* 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@";
|
||||||
static const short qt_configure_str_offsets[] = {
|
static const short qt_configure_str_offsets[] = {
|
||||||
@QT_CONFIG_STR_OFFSETS_FIRST@
|
@QT_CONFIG_STR_OFFSETS_FIRST@
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user