Sfoglia il codice sorgente

Build plugin support library with PIC on Linux and BSD

Co-authored-by: Patrick Heyer <PatTheMav@users.noreply.github.com>
Roy Shilkrot 1 anno fa
parent
commit
0292985515
1 ha cambiato i file con 6 aggiunte e 0 eliminazioni
  1. 6 0
      cmake/common/helpers_common.cmake

+ 6 - 0
cmake/common/helpers_common.cmake

@@ -134,4 +134,10 @@ if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/src/plugin-support.c.in")
     PRIVATE plugin-support.c
     PUBLIC src/plugin-support.h)
   target_include_directories(plugin-support PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/src")
+  if(OS_LINUX
+     OR OS_FREEBSD
+     OR OS_OPENBSD)
+    # add fPIC on Linux to prevent shared object errors
+    set_property(TARGET plugin-support PROPERTY POSITION_INDEPENDENT_CODE ON)
+  endif()
 endif()