aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDRC <dcommander@users.sourceforge.net>2011-08-23 20:35:06 +0000
committerDRC <dcommander@users.sourceforge.net>2011-08-23 20:35:06 +0000
commitce82f4bbcd4fe491132a0b9aa772e25159179ba1 (patch)
treec3123c8d85cc70653faa936931ddea998e7e6b08
parentf340e7c33813e4979e817209fe3d93d3a685cfdf (diff)
downloadtigervnc-ce82f4bbcd4fe491132a0b9aa772e25159179ba1.tar.gz
tigervnc-ce82f4bbcd4fe491132a0b9aa772e25159179ba1.zip
Move setting of PIC code to a central location
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4648 3789f03b-4d11-0410-bbf8-ca57d06f2519
-rw-r--r--common/CMakeLists.txt13
-rw-r--r--common/Xregion/CMakeLists.txt8
-rw-r--r--common/network/CMakeLists.txt8
-rw-r--r--common/os/CMakeLists.txt8
-rw-r--r--common/rdr/CMakeLists.txt8
-rw-r--r--common/rfb/CMakeLists.txt8
-rw-r--r--common/zlib/CMakeLists.txt8
7 files changed, 13 insertions, 48 deletions
diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt
index 1d9f1d66..fd22455a 100644
--- a/common/CMakeLists.txt
+++ b/common/CMakeLists.txt
@@ -14,3 +14,16 @@ add_subdirectory(rdr)
add_subdirectory(network)
add_subdirectory(Xregion)
add_subdirectory(rfb)
+
+# For any convenience libraries that are linked into libvnc.so, we need to
+# explicitly build their corresponding sources using PIC. WIN32 is excluded
+# because PIC code does not exist on that platform and MinGW complains if -fPIC
+# is passed (additionally, libvnc is not used on Windows.)
+
+if(CMAKE_COMPILER_IS_GNUCXX AND (CMAKE_SIZEOF_VOID_P MATCHES 8) AND NOT WIN32)
+ set_target_properties(os rdr network Xregion rfb
+ PROPERTIES COMPILE_FLAGS -fPIC)
+ if(USE_INCLUDED_ZLIB)
+ set_target_properties(zlib PROPERTIES COMPILE_FLAGS -fPIC)
+ endif()
+endif()
diff --git a/common/Xregion/CMakeLists.txt b/common/Xregion/CMakeLists.txt
index a7788ebd..40ca97e4 100644
--- a/common/Xregion/CMakeLists.txt
+++ b/common/Xregion/CMakeLists.txt
@@ -1,14 +1,6 @@
add_library(Xregion STATIC
Region.c)
-# This code goes into libvnc.so, so it needs to be PIC on x86_64.
-# (It should be on archs as well, but we prefer performance over memory
-# efficiency. Win64 is excluded because PIC is always on there and it
-# complains when you give it the explicit flag.)
-if(CMAKE_COMPILER_IS_GNUCXX AND (CMAKE_SIZEOF_VOID_P MATCHES 8) AND NOT WIN32)
- set_target_properties(Xregion PROPERTIES COMPILE_FLAGS -fPIC)
-endif()
-
if(UNIX)
libtool_create_control_file(Xregion)
endif()
diff --git a/common/network/CMakeLists.txt b/common/network/CMakeLists.txt
index 681d2912..ddde5745 100644
--- a/common/network/CMakeLists.txt
+++ b/common/network/CMakeLists.txt
@@ -3,14 +3,6 @@ include_directories(${CMAKE_SOURCE_DIR}/common)
add_library(network STATIC
TcpSocket.cxx)
-# This code goes into libvnc.so, so it needs to be PIC on x86_64.
-# (It should be on archs as well, but we prefer performance over memory
-# efficiency. Win64 is excluded because PIC is always on there and it
-# complains when you give it the explicit flag.)
-if(CMAKE_COMPILER_IS_GNUCXX AND (CMAKE_SIZEOF_VOID_P MATCHES 8) AND NOT WIN32)
- set_target_properties(network PROPERTIES COMPILE_FLAGS -fPIC)
-endif()
-
if(UNIX)
libtool_create_control_file(network)
endif()
diff --git a/common/os/CMakeLists.txt b/common/os/CMakeLists.txt
index 623a32f8..82f11659 100644
--- a/common/os/CMakeLists.txt
+++ b/common/os/CMakeLists.txt
@@ -5,11 +5,3 @@ add_library(os STATIC
net.c
os.cxx
tls.cxx)
-
-# This code goes into libvnc.so, so it needs to be PIC on x86_64.
-# (It should be on archs as well, but we prefer performance over memory
-# efficiency. Win64 is excluded because PIC is always on there and it
-# complains when you give it the explicit flag.)
-if(CMAKE_COMPILER_IS_GNUCXX AND (CMAKE_SIZEOF_VOID_P MATCHES 8) AND NOT WIN32)
- set_target_properties(os PROPERTIES COMPILE_FLAGS -fPIC)
-endif()
diff --git a/common/rdr/CMakeLists.txt b/common/rdr/CMakeLists.txt
index 6d3ec1d6..ee71a9bb 100644
--- a/common/rdr/CMakeLists.txt
+++ b/common/rdr/CMakeLists.txt
@@ -24,14 +24,6 @@ endif()
target_link_libraries(rdr ${RDR_LIBRARIES})
-# This code goes into libvnc.so, so it needs to be PIC on x86_64.
-# (It should be on archs as well, but we prefer performance over memory
-# efficiency. Win64 is excluded because PIC is always on there and it
-# complains when you give it the explicit flag.)
-if(CMAKE_COMPILER_IS_GNUCXX AND (CMAKE_SIZEOF_VOID_P MATCHES 8) AND NOT WIN32)
- set_target_properties(rdr PROPERTIES COMPILE_FLAGS -fPIC)
-endif()
-
if(UNIX)
libtool_create_control_file(rdr)
endif()
diff --git a/common/rfb/CMakeLists.txt b/common/rfb/CMakeLists.txt
index f8c1a432..be03c646 100644
--- a/common/rfb/CMakeLists.txt
+++ b/common/rfb/CMakeLists.txt
@@ -95,14 +95,6 @@ add_library(rfb STATIC ${RFB_SOURCES})
target_link_libraries(rfb ${RFB_LIBRARIES})
-# This code goes into libvnc.so, so it needs to be PIC on x86_64.
-# (It should be on archs as well, but we prefer performance over memory
-# efficiency. Win64 is excluded because PIC is always on there and it
-# complains when you give it the explicit flag.)
-if(CMAKE_COMPILER_IS_GNUCXX AND (CMAKE_SIZEOF_VOID_P MATCHES 8) AND NOT WIN32)
- set_target_properties(rfb PROPERTIES COMPILE_FLAGS -fPIC)
-endif()
-
if(UNIX)
libtool_create_control_file(rfb)
endif()
diff --git a/common/zlib/CMakeLists.txt b/common/zlib/CMakeLists.txt
index ecee0eb9..69f1c9f9 100644
--- a/common/zlib/CMakeLists.txt
+++ b/common/zlib/CMakeLists.txt
@@ -20,11 +20,3 @@ add_library(zlib STATIC
trees.c
uncompr.c
zutil.c)
-
-# This code goes into libvnc.so, so it needs to be PIC on x86_64.
-# (It should be on other archs as well, but we prefer performance over memory
-# efficiency. Win64 is excluded because PIC is always on there and it
-# complains when you give it the explicit flag.)
-if(CMAKE_COMPILER_IS_GNUCXX AND (CMAKE_SIZEOF_VOID_P MATCHES 8) AND NOT WIN32)
- set_target_properties(zlib PROPERTIES COMPILE_FLAGS -fPIC)
-endif()