1# Copyright 2019 Google LLC 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# https://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15# On Debian, install libffi-dev to use this module. 16 17find_path(libffi_INCLUDE_DIR ffitarget.h) 18# Look for static library only. 19find_library(libffi_LIBRARY ffi) 20mark_as_advanced(libffi_INCLUDE_DIR libffi_LIBRARY) 21 22include(FindPackageHandleStandardArgs) 23find_package_handle_standard_args(libffi 24 REQUIRED_VARS libffi_LIBRARY libffi_INCLUDE_DIR 25) 26 27if(libffi_FOUND AND NOT TARGET libffi::libffi) 28 add_library(libffi::libffi UNKNOWN IMPORTED) 29 set_target_properties(libffi::libffi PROPERTIES 30 IMPORTED_LINK_INTERFACE_LANGUAGES "C" 31 IMPORTED_LOCATION "${libffi_LIBRARY}" 32 INTERFACE_INCLUDE_DIRECTORIES "${libffi_INCLUDE_DIR}" 33 ) 34endif() 35