From 36bf37cb638cd87d7f8eb96afaf69c2d95177614 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 f08eaa31..85c05951 100644
--- a/common/network/CMakeLists.txt
+++ b/common/network/CMakeLists.txt
@@ -15,4 +15,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 30c2403a..94e1ff98 100644
--- a/common/rdr/CMakeLists.txt
+++ b/common/rdr/CMakeLists.txt
@@ -35,4 +35,5 @@ endif()
 
 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 360434a9..28566e90 100644
--- a/common/rfb/CMakeLists.txt
+++ b/common/rfb/CMakeLists.txt
@@ -116,4 +116,5 @@ endif()
 
 if(UNIX)
   libtool_create_control_file(rfb)
+  set_target_properties(rfb PROPERTIES COMPILE_FLAGS -fPIC)
 endif()
-- 
2.25.1

