From e79fbb87decbd180214381a6af8327945846b559 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sl=C3=A1vek=20Banko?= Date: Thu, 29 Nov 2018 01:15:39 +0100 Subject: [PATCH] Use POSITION_INDEPENDENT_CODE property for CMake >= 2.8.9. This resolves bug 2985. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Slávek Banko (cherry picked from commit e5b3a250fcbddc2d153832a386a7b67b340b8dac) --- modules/TDEMacros.cmake | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/TDEMacros.cmake b/modules/TDEMacros.cmake index 020878b..9a23fc9 100644 --- a/modules/TDEMacros.cmake +++ b/modules/TDEMacros.cmake @@ -720,7 +720,11 @@ macro( tde_add_library _arg_target ) # set -fPIC flag for static libraries if( _static_pic ) - set_target_properties( ${_target} PROPERTIES COMPILE_FLAGS -fPIC ) + if( "${CMAKE_VERSION}" VERSION_LESS "2.8.9" ) + set_target_properties( ${_target} PROPERTIES COMPILE_FLAGS -fPIC ) + else( ) + set_target_properties( ${_target} PROPERTIES POSITION_INDEPENDENT_CODE ON ) + endif( ) endif( _static_pic ) # set version