From 92b4f9de986c5a9b72af8af61b8d3afcab1581d5 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Mon, 22 Aug 2011 11:38:35 +0000 Subject: CMake doesn't handle convenience libraries as nicely as autotools does. We need to be explicit with -fPIC here as we use these in libvnc.so. git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4645 3789f03b-4d11-0410-bbf8-ca57d06f2519 --- common/network/CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'common/network/CMakeLists.txt') diff --git a/common/network/CMakeLists.txt b/common/network/CMakeLists.txt index ddde5745..681d2912 100644 --- a/common/network/CMakeLists.txt +++ b/common/network/CMakeLists.txt @@ -3,6 +3,14 @@ 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() -- cgit v1.2.3