diff options
author | Joseph Huber <huberjn@outlook.com> | 2024-01-22 07:27:06 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-22 07:27:06 -0600 |
commit | b689b4fe55103a04eac847964e126b6048b89ae0 (patch) | |
tree | 3f980569b78f1254704505a7391e8d7e498974ba /openmp/libomptarget/plugins-nextgen/CMakeLists.txt | |
parent | ab1b4991cfacfe04a579bf0b0ff4a704a6224d4a (diff) | |
download | llvm-b689b4fe55103a04eac847964e126b6048b89ae0.zip llvm-b689b4fe55103a04eac847964e126b6048b89ae0.tar.gz llvm-b689b4fe55103a04eac847964e126b6048b89ae0.tar.bz2 |
[LLVM][CMake] Add ffi_static target for the FFI static library (#78779)
Summary:
This patch is an attempt to make the `find_package(FFI)` support in LLVM
prefer to provide the static library version if present. This is
currently
an optional library for building `libffi`, and its presence implies that
it should likely be used. This patch is an attempt to fix some problems
observed with testing programs linked against `libffi` on many different
systems that could have conflicting paths. Linking it statically
prevents this.
This patch adds the `ffi_static` target for this library.
Diffstat (limited to 'openmp/libomptarget/plugins-nextgen/CMakeLists.txt')
-rw-r--r-- | openmp/libomptarget/plugins-nextgen/CMakeLists.txt | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/openmp/libomptarget/plugins-nextgen/CMakeLists.txt b/openmp/libomptarget/plugins-nextgen/CMakeLists.txt index 9b4e945..f5fc3b6 100644 --- a/openmp/libomptarget/plugins-nextgen/CMakeLists.txt +++ b/openmp/libomptarget/plugins-nextgen/CMakeLists.txt @@ -49,11 +49,14 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "${tmachine}$") ) if(LIBOMPTARGET_DEP_LIBFFI_FOUND) - libomptarget_say("Building ${tmachine_libname} plugin linked with libffi") - target_link_libraries("omptarget.rtl.${tmachine_libname}" PRIVATE - ${FFI_LIBRARIES}) - target_include_directories("omptarget.rtl.${tmachine_libname}" PRIVATE - ${FFI_INCLUDE_DIRS}) + libomptarget_say("Building ${tmachine_libname} plugin linked with libffi") + if(FFI_STATIC_LIBRARIES) + target_link_libraries( + "omptarget.rtl.${tmachine_libname}" PRIVATE FFI::ffi_static) + else() + target_link_libraries( + "omptarget.rtl.${tmachine_libname}" PRIVATE FFI::ffi) + endif() else() libomptarget_say("Building ${tmachine_libname} plugie for dlopened libffi") target_sources("omptarget.rtl.${tmachine_libname}" PRIVATE |