From 120bb5f644bbcdcb7197d476dc70587d3a3e4b2a Mon Sep 17 00:00:00 2001 From: Volker Krause Date: Sat, 8 Jan 2022 12:45:07 +0100 Subject: Only enable -bsymbolic-functions when Qt is built in a compatible way With Qt6 that isn't always the case, for example in our Linux CI image. Using -bsymbolic-function on the final executable in that case can result in function pointer conntect or method/signal lookups to fail. This can be observed in various unit test failures on the CI right now. --- kde-modules/KDEFrameworkCompilerSettings.cmake | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/kde-modules/KDEFrameworkCompilerSettings.cmake b/kde-modules/KDEFrameworkCompilerSettings.cmake index 9c6efd67..de700d7e 100644 --- a/kde-modules/KDEFrameworkCompilerSettings.cmake +++ b/kde-modules/KDEFrameworkCompilerSettings.cmake @@ -41,9 +41,17 @@ if (ECM_GLOBAL_FIND_VERSION VERSION_LESS 5.85.0) return() endif() -# set ENABLE_BSYMBOLICFUNCTIONS default to ON +# set ENABLE_BSYMBOLICFUNCTIONS default to ON when possible # TODO: find a nice way to set an option default -set(ENABLE_BSYMBOLICFUNCTIONS ON) +# we can only use symbolic functions when everything is built with that +# otherwise we'll break function pointer based connects and method lookups +include(${CMAKE_CURRENT_LIST_DIR}/../modules/QtVersionOption.cmake) +if (QT_MAJOR_VERSION EQUAL "6") + find_package(Qt6Core) + set(ENABLE_BSYMBOLICFUNCTIONS ${QT_FEATURE_reduce_relocations}) +else () + set(ENABLE_BSYMBOLICFUNCTIONS ON) +endif() # Current defaults include(KDECompilerSettings NO_POLICY_SCOPE) -- cgit v1.2.1