]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cmake: extract the RDMA libraries interface properties out 22752/head
authorKefu Chai <kchai@redhat.com>
Thu, 28 Jun 2018 09:05:53 +0000 (17:05 +0800)
committerKefu Chai <kchai@redhat.com>
Thu, 28 Jun 2018 15:26:28 +0000 (23:26 +0800)
Signed-off-by: Kefu Chai <kchai@redhat.com>
cmake/modules/Findrdmacm.cmake
cmake/modules/Findverbs.cmake
src/CMakeLists.txt

index c6b199aaa6b6de92db67a17822995ac5133c4bbb..0016180f41f0008b36b411304723f2cd423b1e33 100644 (file)
@@ -11,6 +11,16 @@ find_library(RDMACM_LIBRARIES rdmacm)
 include(FindPackageHandleStandardArgs)
 find_package_handle_standard_args(rdmacm DEFAULT_MSG RDMACM_LIBRARIES RDMACM_INCLUDE_DIR)
 
+if(RDMACM_FOUND)
+  if(NOT TARGET RDMA::RDMAcm)
+    add_library(RDMA::RDMAcm UNKNOWN IMPORTED)
+  endif()
+  set_target_properties(RDMA::RDMAcm PROPERTIES
+    INTERFACE_INCLUDE_DIRECTORIES "${RDMACM_INCLUDE_DIR}"
+    IMPORTED_LINK_INTERFACE_LANGUAGES "C"
+    IMPORTED_LOCATION "${RDMACM_LIBRARIES}")
+endif()
+
 mark_as_advanced(
   RDMACM_LIBRARIES
 )
index 0409fe74aa78dec88fb2a70800b7765d83b07411..e266a4ebc9fae3a2b447b77206185cb32f37ab9a 100644 (file)
@@ -22,6 +22,13 @@ if(VERBS_FOUND)
       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(
index 1b857599e592d9eb1655d18e92fa181f6da91661..2521ecfaab02df45b3c88b9d3043720b6c6ee643 100644 (file)
@@ -297,17 +297,6 @@ if(HAVE_XIO)
   list(APPEND EXTRALIBS ${XIO_LIBRARY} pthread)
 endif(HAVE_XIO)
 
-if(HAVE_RDMACM)
-  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I${RDMACM_INCLUDE_DIR}")
-  list(APPEND EXTRALIBS ${RDMACM_LIBRARIES} pthread)
-endif(HAVE_RDMACM)
-
-if(HAVE_VERBS)
-  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I${VERBS_INCLUDE_DIR}")
-  list(APPEND EXTRALIBS ${VERBS_LIBRARIES} pthread)
-endif(HAVE_VERBS)
-
-
 # sort out which allocator to use
 if(ALLOCATOR STREQUAL "tcmalloc")
   set(ALLOC_LIBS ${GPERFTOOLS_TCMALLOC_LIBRARY})
@@ -672,10 +661,10 @@ if(HAVE_UDEV)
   list(APPEND ceph_common_deps ${UDEV_LIBRARIES})
 endif()
 if(HAVE_VERBS)
-  list(APPEND ceph_common_deps ${VERBS_LIBRARIES})
+  list(APPEND ceph_common_deps IBVerbs::verbs)
 endif()
 if(HAVE_RDMACM)
-  list(APPEND ceph_common_deps ${RDMACM_LIBRARIES})
+  list(APPEND ceph_common_deps RDMA::RDMAcm)
 endif()
 if(NOT WITH_SYSTEM_BOOST)
   list(APPEND ceph_common_deps ${ZLIB_LIBRARIES})