diff options
Diffstat (limited to 'cmake/QtBuild.cmake')
-rw-r--r-- | cmake/QtBuild.cmake | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake index 4c5a7a6019..8deb9b8cbd 100644 --- a/cmake/QtBuild.cmake +++ b/cmake/QtBuild.cmake @@ -1573,6 +1573,7 @@ function(qt_add_module target) ### Define Targets: set(is_interface_lib 0) + set(is_shared_lib 0) if(${arg_HEADER_MODULE}) add_library("${target}" INTERFACE) set(is_interface_lib 1) @@ -1580,6 +1581,7 @@ function(qt_add_module target) add_library("${target}" STATIC) elseif(${QT_BUILD_SHARED_LIBS}) add_library("${target}" SHARED) + set(is_shared_lib 1) else() add_library("${target}" STATIC) endif() @@ -1596,6 +1598,19 @@ function(qt_add_module target) ) endif() + if(QT_FEATURE_reduce_relocations AND UNIX AND NOT is_interface_lib) + # On x86 and x86-64 systems with ELF binaries (especially Linux), due to + # a new optimization in GCC 5.x in combination with a recent version of + # GNU binutils, compiling Qt applications with -fPIE is no longer + # enough. + # Applications now need to be compiled with the -fPIC option if the Qt option + # \"reduce relocations\" is active. + target_compile_options(${target} INTERFACE -fPIC) + if(GCC AND is_shared_lib) + target_link_options(${target} PRIVATE LINKER:-Bsymbolic-functions) + endif() + endif() + if (ANDROID) qt_android_apply_arch_suffix("${target}") endif() |