aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Krause <vkrause@kde.org>2022-01-08 12:45:07 +0100
committerVolker Krause <vkrause@kde.org>2022-01-20 15:57:43 +0000
commit120bb5f644bbcdcb7197d476dc70587d3a3e4b2a (patch)
tree7fe658ebcf00d98decfbc91e52aa23e6180b99f2
parent4b1c7b7338587355d72c24ec645830096c90ac84 (diff)
downloadextra-cmake-modules-120bb5f644bbcdcb7197d476dc70587d3a3e4b2a.tar.gz
extra-cmake-modules-120bb5f644bbcdcb7197d476dc70587d3a3e4b2a.tar.bz2
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.
-rw-r--r--kde-modules/KDEFrameworkCompilerSettings.cmake12
1 files 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)