CMake: Apply $ORIGIN style rpaths for non-prefix builds as well

This works around linking issues when doing yocto non-prefix Qt
builds, because CMake does not add -rpath-link flags even though it
probably should.

Task-number: QTBUG-86533
Change-Id: Iaaf246ac71ca05d9369ceb6eb9c4a1e206c42839
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
Alexandru Croitor 2020-09-09 17:59:06 +02:00
parent ff1a44be33
commit abf7239541

View File

@ -49,7 +49,7 @@ endfunction()
function(qt_apply_rpaths)
# No rpath support for win32 and android. Also no need to apply rpaths when doing a non-prefix
# build.
if(NOT QT_WILL_INSTALL OR WIN32 OR ANDROID)
if(WIN32 OR ANDROID)
return()
endif()
@ -128,6 +128,11 @@ function(qt_apply_rpaths)
if(rpaths)
list(REMOVE_DUPLICATES rpaths)
set_property(TARGET "${target}" APPEND PROPERTY INSTALL_RPATH ${rpaths})
if(QT_WILL_INSTALL)
set(prop_name "INSTALL_RPATH")
else()
set(prop_name "BUILD_RPATH")
endif()
set_property(TARGET "${target}" APPEND PROPERTY "${prop_name}" ${rpaths})
endif()
endfunction()