Changes FindFFI so that the dir /usr/local/opt/libffi has prefernce over /usr/lib for finding libffi.
The OSX build is giving some problems for the updated brew libffi.
# FFI_FOUND - System has libffi
# FFI::lib - Imported target for the libffi
-# try using pkg-config if available
-find_package(PkgConfig QUIET)
-
-if (APPLE AND PkgConfig_FOUND)
- #set brew location for pkg-config
- set(ENV{PKG_CONFIG_PATH} "/usr/local/opt/libffi/lib/pkgconfig:$ENV{PKG_CONFIG_PATH}")
-
- pkg_check_modules(PC_LIBFFI QUIET libffi>=3.2.1)
-
- #use found LIBFFI pkg config info to search for the abs path fo the libffi lib.
- #Note that the abs path info is not present in the pkg-config results (only the -l and -L arguments)
- find_library(FFI_ABS_LIB NAMES ffi
- PATHS ${PC_LIBFFI_LIBRARY_DIRS} ${PC_LIBFFI_LIBDIR}
- NO_DEFAULT_PATH
- NO_PACKAGE_ROOT_PATH
- NO_CMAKE_PATH
- NO_CMAKE_SYSTEM_PATH
- )
-
- if (NOT FFI_ABS_LIB)
- message(WARNING "Cannot find abs path of libffi based on pkgconfig results. Tried to find libffi @ '${PC_LIBFFI_LIBRARY_DIRS}' and '${PC_LIBFFI_LIBDIR}'")
- else()
- unset(FFI_ABS_LIB)
- endif()
-endif()
-
-mark_as_advanced(GNUTLS_INCLUDE_DIR GNUTLS_LIBRARY)
-
find_library(FFI_LIBRARY NAMES ffi libffi
- PATHS $ENV{FFI_DIR} ${FFI_DIR} /usr /usr/local /opt/local
+ NO_DEFAULT_PATH
+ PATHS $ENV{FFI_DIR} ${FFI_DIR} /usr/local/opt/libffi /opt/local /usr /usr/local
PATH_SUFFIXES lib lib64 x86_64-linux-gnu lib/x86_64-linux-gnu
HINTS ${PC_LIBFFI_LIBDIR} ${PC_LIBFFI_LIBRARY_DIRS}
)
find_path(FFI_INCLUDE_DIR ffi.h
- PATHS $ENV{FFI_DIR} ${FFI_DIR} /usr /usr/local /opt/local
+ NO_DEFAULT_PATH
+ PATHS $ENV{FFI_DIR} ${FFI_DIR} /usr/local/opt/libffi /opt/local /usr /usr/local
PATH_SUFFIXES include include/ffi include/x86_64-linux-gnu x86_64-linux-gnu
HINTS ${PC_LIBFFI_INCLUDEDIR} ${PC_LIBFFI_INCLUDE_DIRS}
)
