CMake: Don't hard-code the sysroot in Qt5XXXConfigExtras.cmake

Instead of writing the hard-coded sysroot into the .cmake file, write
the variable ${CMAKE_SYSROOT}. This makes it possible to relocate the
build to a machine where the sysroot is different from the build
machine.

Fixes: QTBUG-83335
Change-Id: Iaa69feb9a140b050f6b5547929cc940ee0f039ce
Reviewed-by: Rolf Eike Beer <eb@emlix.com>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Joerg Bornemann 2020-04-30 06:13:03 +02:00
parent 76fe36645e
commit 786ae0141a

View File

@ -42,10 +42,17 @@ defineReplace(cmakeTargetPaths) {
} }
defineReplace(cmakePortablePaths) { defineReplace(cmakePortablePaths) {
SYSR = $$[QT_SYSROOT]
!isEmpty(SYSR): SYSR = ${CMAKE_SYSROOT}
variable = $$1 variable = $$1
out = out =
for(v, variable) { for(v, variable) {
out += $$[QT_SYSROOT]$$cmakeTargetPath($$v) path = $$cmakeTargetPath($$v)
contains(path, /.*): \
sysroot_prefix = $$SYSR
else: \
sysroot_prefix = $$SYSR/
out += $${sysroot_prefix}$${path}
} }
return ($$join(out, ";")) return ($$join(out, ";"))
} }