From 7f8acd59bb2e54f9be25a98dd71534700a9e355a Mon Sep 17 00:00:00 2001
From: Chen Qi <Qi.Chen@windriver.com>
Date: Mon, 19 Apr 2021 23:14:28 -0700
Subject: [PATCH] tigervnc: add fPIC option to COMPILE_FLAGS

The static libraries in 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>
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
 common/network/CMakeLists.txt | 1 +
 common/rdr/CMakeLists.txt     | 1 +
 common/rfb/CMakeLists.txt     | 1 +
 3 files changed, 3 insertions(+)

diff --git a/common/network/CMakeLists.txt b/common/network/CMakeLists.txt
index d00ca452..e84e0290 100644
--- a/common/network/CMakeLists.txt
+++ b/common/network/CMakeLists.txt
@@ -16,4 +16,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 989ba2f4..20f6489d 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 fc5a37bf..7f5ce131 100644
--- a/common/rfb/CMakeLists.txt
+++ b/common/rfb/CMakeLists.txt
@@ -99,4 +99,5 @@ target_link_libraries(rfb ${RFB_LIBRARIES})
 
 if(UNIX)
   libtool_create_control_file(rfb)
+  set_target_properties(rfb PROPERTIES COMPILE_FLAGS -fPIC)
 endif()
-- 
2.30.2

