From 3981f867377ca0652d0cc0ababbbc30208db7e1c Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Mon, 24 Dec 2018 20:53:53 +0100 Subject: add -fPIC in cmake --- cmake/linux.cmake | 4 ++-- cmake/opentrack-platform.cmake | 2 ++ x-plane-plugin/CMakeLists.txt | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/cmake/linux.cmake b/cmake/linux.cmake index 945f7e77..326c4d4a 100644 --- a/cmake/linux.cmake +++ b/cmake/linux.cmake @@ -1,7 +1,7 @@ set(CMAKE_BUILD_TYPE_INIT RELEASE) -set(CMAKE_CXX_FLAGS "-fPIC" CACHE STRING "" FORCE) -set(CMAKE_C_FLAGS "-fPIC" CACHE STRING "" FORCE) +set(CMAKE_CXX_FLAGS "" CACHE STRING "" FORCE) +set(CMAKE_C_FLAGS "" CACHE STRING "" FORCE) set(CMAKE_AR "gcc-ar" CACHE STRING "" FORCE) set(CMAKE_NM "gcc-nm" CACHE STRING "" FORCE) diff --git a/cmake/opentrack-platform.cmake b/cmake/opentrack-platform.cmake index 107130f5..1df19b2b 100644 --- a/cmake/opentrack-platform.cmake +++ b/cmake/opentrack-platform.cmake @@ -34,6 +34,8 @@ endif() string(TOUPPER "${CMAKE_BUILD_TYPE}" __build_type) set(CMAKE_BUILD_TYPE "${__build_type}" CACHE STRING "" FORCE) +set(CMAKE_POSITION_INDEPENDENT_CODE TRUE) + if (CMAKE_SYSTEM_PROCESSOR MATCHES "amd64.*|x86_64.*|AMD64.*|i[0-9]86.*|x86.*") set(opentrack-intel TRUE) else() diff --git a/x-plane-plugin/CMakeLists.txt b/x-plane-plugin/CMakeLists.txt index b827b7ab..f7bb7a3f 100644 --- a/x-plane-plugin/CMakeLists.txt +++ b/x-plane-plugin/CMakeLists.txt @@ -14,9 +14,9 @@ if(LINUX OR APPLE) LINK_FLAGS "-F${SDK_XPLANE}/Libraries/Mac/ -framework XPLM -framework XPWidgets ") elseif(CMAKE_COMPILER_IS_GNUCXX) set_property(TARGET opentrack-xplane-plugin APPEND_STRING PROPERTY - COMPILE_FLAGS "-fPIC -DLIN -DXPLM200 -DXPLM210 ") + COMPILE_FLAGS "-DLIN -DXPLM200 -DXPLM210 ") set_property(TARGET opentrack-xplane-plugin APPEND_STRING PROPERTY - LINK_FLAGS "-rdynamic -nodefaultlibs -fPIC ") + LINK_FLAGS "-rdynamic -nodefaultlibs ") endif() if(CMAKE_COMPILER_IS_GNUCC AND NOT CMAKE_COMPILER_IS_CLANG) -- cgit v1.2.3