diff options
author | Peter Wu <peter@lekensteyn.nl> | 2015-10-21 16:52:47 +0200 |
---|---|---|
committer | Michal Labedzki <michal.labedzki@tieto.com> | 2015-10-22 06:16:24 +0000 |
commit | 1eba9d926bbfb9fa3c5540414c68f4a5e9b66bd8 (patch) | |
tree | 217653c8c99d8570f412b58ba3e204ca22aec22b | |
parent | b7de996684891c4d0584f78241d814de26509f44 (diff) |
Avoid adding -pie on older cmake versions
Fixes building on Ubuntu 12.04 x86_64 which has cmake 2.8.7.
Bug: 11617
Change-Id: I253e9fda698d4b963d50516e483d8243231f056b
Reviewed-on: https://code.wireshark.org/review/11193
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michal Labedzki <michal.labedzki@tieto.com>
Tested-by: Michal Labedzki <michal.labedzki@tieto.com>
-rw-r--r-- | CMakeLists.txt | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index d9ba012e0f..140f8eb7da 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -230,6 +230,10 @@ if( NOT CMAKE_SYSTEM_NAME STREQUAL "Linux" AND endif() # Always enable -fPIE (or -fPIC). -pie is added below for non-MSVC. +# Needed when either: +# - Qt5_POSITION_INDEPENDENT_CODE is set and CMake < 2.8.11 +# - PIE is wanted (-pie) and you want to add -fPIC/-fPIE automatically. +# This option only has an effect on CMake >= 2.8.9 set(CMAKE_POSITION_INDEPENDENT_CODE ON) if( CMAKE_C_COMPILER_ID MATCHES "MSVC") @@ -592,11 +596,17 @@ endif() if(NOT CMAKE_C_COMPILER_ID MATCHES "MSVC") set(WIRESHARK_LD_FLAGS -Wl,--as-needed - -pie # -flto # -fwhopr # -fwhole-program ) + # CMAKE_POSITION_INDEPENDENT_CODE is only supported starting with CMake + # 2.8.9. Do not add -pie automatically for older versions. + if(NOT CMAKE_VERSION VERSION_LESS "2.8.9") + set(WIRESHARK_LD_FLAGS ${WIRESHARK_LD_FLAGS} + -pie + ) + endif() endif() include(CheckCLinkerFlag) |