diff --git a/openmp/libomptarget/plugins-nextgen/CMakeLists.txt b/openmp/libomptarget/plugins-nextgen/CMakeLists.txt index d81e5d37d7c08..5f97a77327c0f 100644 --- a/openmp/libomptarget/plugins-nextgen/CMakeLists.txt +++ b/openmp/libomptarget/plugins-nextgen/CMakeLists.txt @@ -70,6 +70,7 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "${tmachine}$") LIBRARY DESTINATION "${OPENMP_INSTALL_LIBDIR}") set_target_properties("omptarget.rtl.${tmachine_libname}" PROPERTIES INSTALL_RPATH "$ORIGIN" BUILD_RPATH "$ORIGIN:${CMAKE_CURRENT_BINARY_DIR}/.." + POSITION_INDEPENDENT_CODE ON CXX_VISIBILITY_PRESET protected) target_include_directories( "omptarget.rtl.${tmachine_libname}" PRIVATE diff --git a/openmp/libomptarget/src/CMakeLists.txt b/openmp/libomptarget/src/CMakeLists.txt index bf6c23bd5eb5f..34a8273cfaf64 100644 --- a/openmp/libomptarget/src/CMakeLists.txt +++ b/openmp/libomptarget/src/CMakeLists.txt @@ -46,5 +46,8 @@ endif() # libomptarget.so needs to be aware of where the plugins live as they # are now separated in the build directory. -set_target_properties(omptarget PROPERTIES INSTALL_RPATH "$ORIGIN" BUILD_RPATH "$ORIGIN:${CMAKE_CURRENT_BINARY_DIR}/..") +set_target_properties(omptarget PROPERTIES + POSITION_INDEPENDENT_CODE ON + INSTALL_RPATH "$ORIGIN" + BUILD_RPATH "$ORIGIN:${CMAKE_CURRENT_BINARY_DIR}/..") install(TARGETS omptarget LIBRARY COMPONENT omptarget DESTINATION "${OPENMP_INSTALL_LIBDIR}")