From 3000831365312f96c1b4bb6dd70a3f7de1028831 Mon Sep 17 00:00:00 2001 From: Joakim Soderberg Date: Thu, 18 Apr 2013 09:25:17 +0000 Subject: [PATCH] Use -fPIC when possible. So that we can link the library statically to shared libraries. --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 74902fe..3e9b9eb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -79,6 +79,10 @@ if (MSVC) add_definitions( "/W3 /D_CRT_SECURE_NO_WARNINGS /wd4005 /wd4996 /nologo" ) endif() +if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) + set(CMAKE_C_FLAGS "-fPIC") +endif() + # Check for the int-type includes check_include_files (sys/types.h HAVE_SYS_TYPES_H) check_include_files (inttypes.h HAVE_INTTYPES_H)