From: Ferry Huberts <[email protected]>

Signed-off-by: Ferry Huberts <[email protected]>
---
 remote_services/CMakeLists.txt |   12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/remote_services/CMakeLists.txt b/remote_services/CMakeLists.txt
index 03892d9..78b5bde 100644
--- a/remote_services/CMakeLists.txt
+++ b/remote_services/CMakeLists.txt
@@ -15,6 +15,18 @@
 # specific language governing permissions and limitations
 # under the License.
 
+# Add -fPIC for x86_64 Unix platforms; this lib will be linked to a shared lib
+if(UNIX AND NOT WIN32)
+  find_program(CMAKE_UNAME uname /bin /usr/bin /usr/local/bin )
+  if(CMAKE_UNAME)
+    exec_program(uname ARGS -m OUTPUT_VARIABLE CMAKE_SYSTEM_PROCESSOR)
+    set(CMAKE_SYSTEM_PROCESSOR ${CMAKE_SYSTEM_PROCESSOR} CACHE INTERNAL 
"processor type (i386 and x86_64)")
+     if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
+      add_definitions(-fPIC)
+    endif(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
+  endif(CMAKE_UNAME)
+endif(UNIX AND NOT WIN32)
+
 #add_subdirectory(mongoose)
 add_subdirectory(utils)
 
-- 
1.7.10.2

Reply via email to