CMake: Fix automatic sysrootification detection for qmake
The way we detected whether SysrootifyPrefix needs to be set was incorrect. We checked if extprefix == prefix => SysrootifyPrefix should be true. But that was previously always the case for a non-prefix build, which means it was not possible to build apps (due to qmake expecting to find include dirs in the sysroot, despite the non-prefix Qt not being installed anywhere into the sysroot). Instead we should do what qmake does. Only set SysrootifyPrefix to true if extprefix was not provided and a sysroot is available. To make it work for iOS and Android, the sysroot detection code had to be moved earlier than the SysrootifyPrefix detection. Task-number: QTBUG-86053 Change-Id: Idcc1260a675fb2ef9ae27fc9dc42a68b30f763b8 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
parent
2096400d6e
commit
5fa823491b
@ -112,7 +112,21 @@ function(qt_generate_qmake_wrapper_for_target)
|
|||||||
file(RELATIVE_PATH ext_prefix_relative_to_host_prefix "${host_prefix}" "${ext_prefix}")
|
file(RELATIVE_PATH ext_prefix_relative_to_host_prefix "${host_prefix}" "${ext_prefix}")
|
||||||
|
|
||||||
set(content "")
|
set(content "")
|
||||||
if(ext_prefix STREQUAL prefix)
|
|
||||||
|
# On Android CMAKE_SYSROOT is set, but from qmake's point of view it should not be set, because
|
||||||
|
# then qmake generates incorrect Qt module include flags (among other things). Do the same for
|
||||||
|
# darwin uikit cross-compilation.
|
||||||
|
set(sysroot "")
|
||||||
|
if(CMAKE_SYSROOT AND NOT ANDROID AND NOT UIKIT)
|
||||||
|
set(sysroot "${CMAKE_SYSROOT}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Detect if automatic sysrootification should happen. All of the following must be true:
|
||||||
|
# sysroot is set (CMAKE_SYSRROT)
|
||||||
|
# prefix is set (CMAKE_INSTALL_PREFIX)
|
||||||
|
# extprefix is explicitly NOT set (CMAKE_STAGING_PREFIX, not QT_STAGING_PREFIX because that
|
||||||
|
# always ends up having a value)
|
||||||
|
if(NOT CMAKE_STAGING_PREFIX AND sysroot)
|
||||||
set(sysrootify_prefix true)
|
set(sysrootify_prefix true)
|
||||||
else()
|
else()
|
||||||
set(sysrootify_prefix false)
|
set(sysrootify_prefix false)
|
||||||
@ -130,7 +144,7 @@ HostData=${CMAKE_CURRENT_SOURCE_DIR}
|
|||||||
|
|
||||||
# Set $$[QT_HOST_DATA/get] to avoid falling back to the source dir where it isn't explicitly
|
# Set $$[QT_HOST_DATA/get] to avoid falling back to the source dir where it isn't explicitly
|
||||||
# requested.
|
# requested.
|
||||||
# Also make sure to specif the Prefix as well, because it doesn't get inherited from the
|
# Also make sure to specify the Prefix as well, because it doesn't get inherited from the
|
||||||
# [Paths] section.
|
# [Paths] section.
|
||||||
string(APPEND content "[EffectivePaths]
|
string(APPEND content "[EffectivePaths]
|
||||||
HostData=${ext_prefix}
|
HostData=${ext_prefix}
|
||||||
@ -138,14 +152,6 @@ Prefix=${ext_prefix_relative_to_conf_file}
|
|||||||
")
|
")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# On Android CMAKE_SYSROOT is set, but for Qt's purposes it should not be set, because then
|
|
||||||
# qmake generates incorrect Qt module include flags (among other things). Do the same for darwin
|
|
||||||
# cross-compilation.
|
|
||||||
set(sysroot "")
|
|
||||||
if(CMAKE_SYSROOT AND NOT ANDROID AND NOT UIKIT)
|
|
||||||
set(sysroot "${CMAKE_SYSROOT}")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
string(APPEND content
|
string(APPEND content
|
||||||
"[Paths]
|
"[Paths]
|
||||||
Prefix=${ext_prefix_relative_to_conf_file}
|
Prefix=${ext_prefix_relative_to_conf_file}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user