From d99553937cc53b82965421da1ca950c17f16a324 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Thu, 17 Jul 2014 13:32:33 +0100 Subject: [PATCH] cmake: Use POSITION_INDEPENDENT_CODE target property. For convenience libraries, instead of mucking about with compilation flags. Suggested by Chad Versace on Waffle mailing list. --- cmake/ConvenienceLibrary.cmake | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/cmake/ConvenienceLibrary.cmake b/cmake/ConvenienceLibrary.cmake index bf18b381..eb6443e1 100644 --- a/cmake/ConvenienceLibrary.cmake +++ b/cmake/ConvenienceLibrary.cmake @@ -7,13 +7,9 @@ function (add_convenience_library) add_library ("${name}" STATIC ${ARGV}) - if (NOT "${CMAKE_SHARED_LIBRARY_C_FLAGS}" STREQUAL "${CMAKE_SHARED_LIBRARY_CXX_FLAGS}") - message (FATAL_ERROR "CMAKE_SHARED_LIBRARY_C_FLAGS (${CMAKE_SHARED_LIBRARY_C_FLAGS}) != CMAKE_SHARED_LIBRARY_CXX_FLAGS (${CMAKE_SHARED_LIBRARY_CXX_FLAGS})") - endif () - set_target_properties ("${name}" PROPERTIES - # Ensure it can be statically linked in shared libraries - COMPILE_FLAGS "${CMAKE_SHARED_LIBRARY_C_FLAGS}" + # Ensure it can be statically linked onto shared libraries + POSITION_INDEPENDENT_CODE ON ) endfunction ()