2 # Find the rdma library and includes
4 # RDMA_INCLUDE_DIR - where to find ibverbs.h, etc.
5 # RDMA_LIBRARIES - List of libraries when using ibverbs.
6 # RDMA_FOUND - True if ibverbs found.
8 find_path(RDMA_INCLUDE_DIR infiniband/verbs.h)
10 set(RDMA_NAMES ${RDMA_NAMES} ibverbs)
11 find_library(RDMA_LIBRARY NAMES ${RDMA_NAMES})
13 if (RDMA_INCLUDE_DIR AND RDMA_LIBRARY)
15 set(RDMA_LIBRARIES ${RDMA_LIBRARY})
22 message(STATUS "Found libibverbs: ${RDMA_LIBRARY}")
24 include(CheckCXXSourceCompiles)
25 CHECK_CXX_SOURCE_COMPILES("
26 #include <infiniband/verbs.h>
28 struct ibv_context* ctxt;
29 struct ibv_exp_gid_attr gid_attr;
30 ibv_exp_query_gid_attr(ctxt, 1, 0, &gid_attr);
35 message(STATUS "Not Found libibverbs: ${RDMA_LIBRARY}")
36 if (RDMA_FIND_REQUIRED)
37 message(STATUS "Looked for libibverbs named ${RDMA_NAMES}.")
38 message(FATAL_ERROR "Could NOT find libibverbs")
42 # handle the QUIETLY and REQUIRED arguments and set UUID_FOUND to TRUE if
43 # all listed variables are TRUE
44 include(FindPackageHandleStandardArgs)
45 find_package_handle_standard_args(ibverbs DEFAULT_MSG RDMA_LIBRARIES RDMA_INCLUDE_DIR)