summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2014-07-17 13:32:33 +0100
committerJosé Fonseca <jfonseca@vmware.com>2014-07-17 13:33:40 +0100
commitd99553937cc53b82965421da1ca950c17f16a324 (patch)
treef476f66cf27ba025ba41506b8f49a48d90db01b1 /cmake
parent777194d772c831b5dab40cf919523d5665f2a46c (diff)
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.
Diffstat (limited to 'cmake')
-rw-r--r--cmake/ConvenienceLibrary.cmake8
1 files 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 ()