18dc01a
From 7c95e46b96e73ca3c8f748825ba02cc518925107 Mon Sep 17 00:00:00 2001
7606b92
From: =?UTF-8?q?Dan=20Hor=C3=A1k?= <dan[at]danny.cz>
7606b92
Date: Wed, 18 Jan 2012 20:38:46 +0100
18dc01a
Subject: [PATCH 02/12] fix building as a shared library on Unix
7606b92
7606b92
---
18dc01a
 src/BoostParts/CMakeLists.txt       | 4 ++++
18dc01a
 src/Xerces/CMakeLists.txt           | 3 +++
18dc01a
 src/XercesExtensions/CMakeLists.txt | 4 ++++
18dc01a
 src/zipios/CMakeLists.txt           | 3 +++
18dc01a
 src/zlib/CMakeLists.txt             | 3 +++
18dc01a
 5 files changed, 17 insertions(+)
7606b92
7606b92
diff --git a/src/BoostParts/CMakeLists.txt b/src/BoostParts/CMakeLists.txt
18dc01a
index f22410a..a34893c 100644
7606b92
--- a/src/BoostParts/CMakeLists.txt
7606b92
+++ b/src/BoostParts/CMakeLists.txt
7606b92
@@ -105,3 +105,7 @@ if( MSVC )
7606b92
     set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL" ) 
7606b92
     set_target_properties( ${PROJECT_NAME} PROPERTIES STATIC_LIBRARY_FLAGS "/LTCG" )
7606b92
 endif()
18dc01a
+
18dc01a
+if( UNIX AND BUILD_SHARED_FC )
18dc01a
+    add_definitions(-fPIC)
18dc01a
+endif()
7606b92
diff --git a/src/Xerces/CMakeLists.txt b/src/Xerces/CMakeLists.txt
18dc01a
index 33ea5c3..9aa896c 100644
7606b92
--- a/src/Xerces/CMakeLists.txt
7606b92
+++ b/src/Xerces/CMakeLists.txt
7606b92
@@ -174,4 +174,7 @@ else()
7606b92
     # We need to link to pthreads on unix                                 
7606b92
     target_link_libraries( ${PROJECT_NAME} pthread )
7606b92
                        
18dc01a
+    if( BUILD_SHARED_FC )
18dc01a
+        add_definitions(-fPIC)
18dc01a
+    endif()
7606b92
 endif()
7606b92
diff --git a/src/XercesExtensions/CMakeLists.txt b/src/XercesExtensions/CMakeLists.txt
18dc01a
index 08196e0..96310d2 100644
7606b92
--- a/src/XercesExtensions/CMakeLists.txt
7606b92
+++ b/src/XercesExtensions/CMakeLists.txt
7606b92
@@ -48,6 +48,10 @@ elseif( CMAKE_COMPILER_IS_GNUCXX )
7606b92
     add_definitions( -Wall )
7606b92
 endif()
7606b92
 
18dc01a
+if( UNIX AND BUILD_SHARED_FC )
18dc01a
+    add_definitions(-fPIC)
18dc01a
+endif()
18dc01a
+
7606b92
 # needed for correct Xerces header inclusion
7606b92
 add_definitions( -DXERCES_STATIC_LIBRARY )
7606b92
 
7606b92
diff --git a/src/zipios/CMakeLists.txt b/src/zipios/CMakeLists.txt
18dc01a
index 88fdb7d..98ce793 100644
7606b92
--- a/src/zipios/CMakeLists.txt
7606b92
+++ b/src/zipios/CMakeLists.txt
7606b92
@@ -47,3 +47,6 @@ elseif( CMAKE_COMPILER_IS_GNUCXX )
7606b92
     add_definitions( -Wall )
7606b92
 endif()
7606b92
 
18dc01a
+if( UNIX AND BUILD_SHARED_FC )
18dc01a
+    add_definitions(-fPIC)
18dc01a
+endif()
7606b92
diff --git a/src/zlib/CMakeLists.txt b/src/zlib/CMakeLists.txt
7606b92
index e59f844..fb2638b 100644
7606b92
--- a/src/zlib/CMakeLists.txt
7606b92
+++ b/src/zlib/CMakeLists.txt
7606b92
@@ -133,5 +133,8 @@ if( MSVC )
7606b92
     set_target_properties( ${PROJECT_NAME} PROPERTIES STATIC_LIBRARY_FLAGS "/LTCG" )
7606b92
 endif()
7606b92
 
7606b92
+if( UNIX AND BUILD_SHARED_FC )
7606b92
+    add_definitions(-fPIC)
7606b92
+endif()
7606b92
 
7606b92
 
7606b92
-- 
18dc01a
1.8.5.3
7606b92