diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 18:24:20 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 18:24:20 +0000 |
commit | 483eb2f56657e8e7f419ab1a4fab8dce9ade8609 (patch) | |
tree | e5d88d25d870d5dedacb6bbdbe2a966086a0a5cf /cmake/modules/Findverbs.cmake | |
parent | Initial commit. (diff) | |
download | ceph-483eb2f56657e8e7f419ab1a4fab8dce9ade8609.tar.xz ceph-483eb2f56657e8e7f419ab1a4fab8dce9ade8609.zip |
Adding upstream version 14.2.21.upstream/14.2.21upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'cmake/modules/Findverbs.cmake')
-rw-r--r-- | cmake/modules/Findverbs.cmake | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/cmake/modules/Findverbs.cmake b/cmake/modules/Findverbs.cmake new file mode 100644 index 00000000..e266a4eb --- /dev/null +++ b/cmake/modules/Findverbs.cmake @@ -0,0 +1,36 @@ +# - Find rdma verbs +# Find the rdma verbs library and includes +# +# VERBS_INCLUDE_DIR - where to find ibverbs.h, etc. +# VERBS_LIBRARIES - List of libraries when using ibverbs. +# VERBS_FOUND - True if ibverbs found. +# HAVE_IBV_EXP - True if experimental verbs is enabled. + +find_path(VERBS_INCLUDE_DIR infiniband/verbs.h) +find_library(VERBS_LIBRARIES ibverbs) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(verbs DEFAULT_MSG VERBS_LIBRARIES VERBS_INCLUDE_DIR) + +if(VERBS_FOUND) + include(CheckCXXSourceCompiles) + CHECK_CXX_SOURCE_COMPILES(" + #include <infiniband/verbs.h> + int main() { + struct ibv_context* ctxt; + struct ibv_exp_gid_attr gid_attr; + ibv_exp_query_gid_attr(ctxt, 1, 0, &gid_attr); + return 0; + } " HAVE_IBV_EXP) + if(NOT TARGET IBVerbs::verbs) + add_library(IBVerbs::verbs UNKNOWN IMPORTED) + endif() + set_target_properties(IBVerbs::verbs PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${VERBS_INCLUDE_DIR}" + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION "${VERBS_LIBRARIES}") +endif() + +mark_as_advanced( + VERBS_LIBRARIES +) |