From e4f3695f5e0a8687ced4b7955d175a70615f0b31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Thu, 7 Feb 2019 12:24:20 +0100 Subject: [PATCH] cmake: (maybe) build xcb-stuff STATIC library with -fPIC When building plugins as shared libraries, xcb-stuff needs to be built with -fPIC, since a couple of the plugins link against it. --- CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 643785a..c462f8f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,6 +47,13 @@ if (ENABLE_X11) target_link_libraries(xcb-stuff PkgConfig::xcb-errors) endif () + # Since there are plugins linking against xcb-stuff, we need to + # ensure it's compiled with -fPIC when the plugins are compiled as + # shared libraries. + if (CORE_PLUGINS_AS_SHARED_LIBRARIES) + set_property(TARGET xcb-stuff PROPERTY POSITION_INDEPENDENT_CODE 1) + endif () + endif () if (ENABLE_WAYLAND)