From 0d1c2e178a21f3b4cd07bbd07ac8e95eb5c0c7a7 Mon Sep 17 00:00:00 2001 From: Matt Williams Date: Thu, 19 Jul 2012 18:01:31 +0100 Subject: [PATCH] Build the static library as position independent This allows it to be compiled into other shared libraries (like the Python bindings) on x86_64 Linux systems. --- library/PolyVoxCore/CMakeLists.txt | 3 +++ library/PolyVoxUtil/CMakeLists.txt | 3 +++ 2 files changed, 6 insertions(+) diff --git a/library/PolyVoxCore/CMakeLists.txt b/library/PolyVoxCore/CMakeLists.txt index 4d17c1f7..ed3f33c5 100644 --- a/library/PolyVoxCore/CMakeLists.txt +++ b/library/PolyVoxCore/CMakeLists.txt @@ -113,6 +113,9 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include) #Build IF(LIBRARY_TYPE STREQUAL "STATIC") ADD_LIBRARY(PolyVoxCore STATIC ${CORE_SRC_FILES} ${CORE_INC_FILES} ${IMPL_SRC_FILES} ${IMPL_INC_FILES}) + IF(UNIX) + SET_TARGET_PROPERTIES(PolyVoxCore PROPERTIES COMPILE_FLAGS -fPIC) + ENDIF() ENDIF() IF(LIBRARY_TYPE STREQUAL "DYNAMIC") ADD_LIBRARY(PolyVoxCore SHARED ${CORE_SRC_FILES} ${CORE_INC_FILES} ${IMPL_SRC_FILES} ${IMPL_INC_FILES}) diff --git a/library/PolyVoxUtil/CMakeLists.txt b/library/PolyVoxUtil/CMakeLists.txt index a4b44ecb..e7fa62da 100644 --- a/library/PolyVoxUtil/CMakeLists.txt +++ b/library/PolyVoxUtil/CMakeLists.txt @@ -31,6 +31,9 @@ LINK_DIRECTORIES(${PolyVoxCore_BINARY_DIR}/debug ${PolyVoxCore_BINARY_DIR}/relea #Build IF(LIBRARY_TYPE STREQUAL "STATIC") ADD_LIBRARY(PolyVoxUtil STATIC ${UTIL_SRC_FILES} ${UTIL_INC_FILES}) + IF(UNIX) + SET_TARGET_PROPERTIES(PolyVoxCore PROPERTIES COMPILE_FLAGS -fPIC) + ENDIF() ENDIF() IF(LIBRARY_TYPE STREQUAL "DYNAMIC") ADD_LIBRARY(PolyVoxUtil SHARED ${UTIL_SRC_FILES} ${UTIL_INC_FILES})