From 9563b69640227da2220ee0c39077afb736cc96d1 Mon Sep 17 00:00:00 2001
From: Hongxu Jia <hongxu.jia@windriver.com>
Date: Thu, 20 Jul 2017 17:12:17 +0800
Subject: [PATCH 4/4] tigervnc: add fPIC option to COMPILE_FLAGS

The static libraries in Xregion/network/rdr/rfb were linked by shared
library libvnc.so, so we should add fPIC option to COMPILE_FLAGS to fix
relocation issue.

Upstream-Status: Pending

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
 common/Xregion/CMakeLists.txt | 1 +
 common/network/CMakeLists.txt | 1 +
 common/rdr/CMakeLists.txt     | 1 +
 common/rfb/CMakeLists.txt     | 1 +
 4 files changed, 4 insertions(+)

diff --git a/common/Xregion/CMakeLists.txt b/common/Xregion/CMakeLists.txt
index 40ca97e..9411328 100644
--- a/common/Xregion/CMakeLists.txt
+++ b/common/Xregion/CMakeLists.txt
@@ -3,4 +3,5 @@ add_library(Xregion STATIC
 
 if(UNIX)
   libtool_create_control_file(Xregion)
+  set_target_properties(Xregion PROPERTIES COMPILE_FLAGS -fPIC)
 endif()
diff --git a/common/network/CMakeLists.txt b/common/network/CMakeLists.txt
index b624c8e..6c06ec9 100644
--- a/common/network/CMakeLists.txt
+++ b/common/network/CMakeLists.txt
@@ -9,4 +9,5 @@ endif()
 
 if(UNIX)
   libtool_create_control_file(network)
+  set_target_properties(network PROPERTIES COMPILE_FLAGS -fPIC)
 endif()
diff --git a/common/rdr/CMakeLists.txt b/common/rdr/CMakeLists.txt
index 989ba2f..20f6489 100644
--- a/common/rdr/CMakeLists.txt
+++ b/common/rdr/CMakeLists.txt
@@ -27,4 +27,5 @@ target_link_libraries(rdr ${RDR_LIBRARIES})
 
 if(UNIX)
   libtool_create_control_file(rdr)
+  set_target_properties(rdr PROPERTIES COMPILE_FLAGS -fPIC)
 endif()
diff --git a/common/rfb/CMakeLists.txt b/common/rfb/CMakeLists.txt
index 5047e5e..88838ab 100644
--- a/common/rfb/CMakeLists.txt
+++ b/common/rfb/CMakeLists.txt
@@ -98,4 +98,5 @@ target_link_libraries(rfb ${RFB_LIBRARIES})
 
 if(UNIX)
   libtool_create_control_file(rfb)
+  set_target_properties(rfb PROPERTIES COMPILE_FLAGS -fPIC)
 endif()
-- 
2.7.4

