diff options
author | Brad King <brad.king@kitware.com> | 2019-06-19 12:22:05 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2019-06-19 12:22:17 (GMT) |
commit | 5773f12d849815c0a61f09e622e90dd56fb4f333 (patch) | |
tree | df3e21b23af273f9539d0945ff67cba535c7eac6 /Modules | |
parent | 7ccd9a27df8649c17d7b6925851d4e258ea913d9 (diff) | |
parent | 9e99a95c7db5be8c6b979b0170ab4cf78bb32307 (diff) | |
download | CMake-5773f12d849815c0a61f09e622e90dd56fb4f333.zip CMake-5773f12d849815c0a61f09e622e90dd56fb4f333.tar.gz CMake-5773f12d849815c0a61f09e622e90dd56fb4f333.tar.bz2 |
Merge topic 'android-pie-cmp0083'
9e99a95c7d Android: ensure PIE behavior is consistent regardless CMP0083 policy
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3459
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/Platform/Android/abi-common.cmake | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/Modules/Platform/Android/abi-common.cmake b/Modules/Platform/Android/abi-common.cmake index a0b47f4..6bce3c7 100644 --- a/Modules/Platform/Android/abi-common.cmake +++ b/Modules/Platform/Android/abi-common.cmake @@ -12,6 +12,26 @@ if(NOT DEFINED CMAKE_POSITION_INDEPENDENT_CODE set(CMAKE_POSITION_INDEPENDENT_CODE ON) endif() +cmake_policy(GET CMP0083 _CMP0083) +if(_CMP0083 STREQUAL NEW) + # PIE Flags are managed by compiler configuration files + if(CMAKE_SYSTEM_VERSION VERSION_GREATER_EQUAL 16) + # ensure PIE flags are passed to the linker + set(CMAKE_C_LINK_PIE_SUPPORTED YES CACHE INTERNAL "PIE (C)") + set(CMAKE_CXX_LINK_PIE_SUPPORTED YES CACHE INTERNAL "PIE (CXX)") + if(CMAKE_SYSTEM_VERSION VERSION_GREATER_EQUAL 21) + # no PIE executable are no longer supported + set(CMAKE_C_LINK_NO_PIE_SUPPORTED NO CACHE INTERNAL "NO_PIE (C)") + set(CMAKE_CXX_LINK_NO_PIE_SUPPORTED NO CACHE INTERNAL "NO_PIE (CXX)") + endif() + endif() +else() + if(CMAKE_POSITION_INDEPENDENT_CODE) + string(APPEND _ANDROID_ABI_INIT_EXE_LDFLAGS " -fPIE -pie") + endif() +endif() +unset(_CMP0083) + string(APPEND _ANDROID_ABI_INIT_EXE_LDFLAGS " -Wl,--gc-sections") if(NOT _ANDROID_ABI_INIT_EXE_LDFLAGS_NO_nocopyreloc) |