From abf72395411b135054b5820f64f93dfbcda430b8 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Wed, 9 Sep 2020 17:59:06 +0200 Subject: [PATCH] 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 Reviewed-by: Joerg Bornemann --- cmake/QtRpathHelpers.cmake | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/cmake/QtRpathHelpers.cmake b/cmake/QtRpathHelpers.cmake index 6273de3eb6..126ed2c50f 100644 --- a/cmake/QtRpathHelpers.cmake +++ b/cmake/QtRpathHelpers.cmake @@ -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()