diff options
author | Joerg Bornemann <joerg.bornemann@qt.io> | 2023-02-22 10:47:00 +0100 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@qt.io> | 2023-02-27 08:35:58 +0000 |
commit | 550ee1d7529af7440cf3e3444526249f3de3e4ab (patch) | |
tree | 0352d00943111d81917cdc78e7ff63dc59872128 /cmake | |
parent | aecaf09913771e823575b8b382070a3eaa8aeae6 (diff) | |
download | qtbase-550ee1d7529af7440cf3e3444526249f3de3e4ab.tar.gz |
CMake: Fix position independent code linker flags not being set
We set CMAKE_POSITION_INDEPENDENT_CODE to ON and require CMake 3.16.
This sets CMP0083 to NEW and should pass -fPIE to linker calls as well.
However, the PIE-enabling flag is not passed to the linker unless we
call check_pie_supported(). This behavior is documented in CMake's
CMP0083 documentation page.
[ChangeLog][CMake] Qt tools are now built with position independent code
even with Unix toolchains where this is not the default, for example
clang.
Change-Id: I1d98e0ea7063a76e3fddc94d6555c6eaf14c7885
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 4183768d9bc6f80ac7b86c3dbf93e6b251369ae4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 6d301449fd36ccb3ea33dc58d41b44f5ba31ca3a)
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/QtSetup.cmake | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/cmake/QtSetup.cmake b/cmake/QtSetup.cmake index 84d3e41e15..4f0c98a6b9 100644 --- a/cmake/QtSetup.cmake +++ b/cmake/QtSetup.cmake @@ -116,6 +116,10 @@ endif() ## Position independent code: set(CMAKE_POSITION_INDEPENDENT_CODE ON) +# Does the linker support position independent code? +include(CheckPIESupported) +check_pie_supported() + # Do not relink dependent libraries when no header has changed: set(CMAKE_LINK_DEPENDS_NO_SHARED ON) |