aboutsummaryrefslogtreecommitdiffstats
path: root/common/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'common/CMakeLists.txt')
-rw-r--r--common/CMakeLists.txt13
1 files changed, 13 insertions, 0 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()