]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
cmake: Finddpdk: add dpdk::${component} libs
authorKefu Chai <kchai@redhat.com>
Fri, 20 Jul 2018 10:50:07 +0000 (18:50 +0800)
committerKefu Chai <kchai@redhat.com>
Sun, 22 Jul 2018 01:55:23 +0000 (09:55 +0800)
Signed-off-by: Kefu Chai <kchai@redhat.com>
cmake/modules/Finddpdk.cmake
src/CMakeLists.txt

index 47abd1fe57bda8a8a63ee387fde8b37ef277ac96..aff4b47e050112cc988671d21397c769f9487728 100644 (file)
@@ -19,10 +19,16 @@ set(components
 foreach(c ${components})
   find_library(DPDK_rte_${c}_LIBRARY rte_${c}
     HINTS $ENV{DPDK_DIR}/lib)
-endforeach()
-
-foreach(c ${components})
   list(APPEND check_LIBRARIES "${DPDK_rte_${c}_LIBRARY}")
+  if(DPDK_rte_${c}_LIBRARY)
+    add_library(dpdk::${c} UNKNOWN IMPORTED)
+    set_target_properties(dpdk::${c} PROPERTIES
+      INTERFACE_INCLUDE_DIRECTORIES "${DPDK_INCLUDE_DIR}"
+      IMPORTED_LOCATION "${DPDK_rte_${c}_LIBRARY}")
+    target_compile_options(dpdk::${c} INTERFACE
+      "-march=native")
+    list(APPEND DPDK_LIBRARIES dpdk::${c})
+  endif()
 endforeach()
 
 mark_as_advanced(DPDK_INCLUDE_DIR ${check_LIBRARIES})
index e3e9714417067dfe0aa0e60a9f83ae2a0691e1d7..a0988cf9c662304f145e0354a7fb018a3420abf7 100644 (file)
@@ -692,15 +692,9 @@ if(WITH_DPDK)
     msg/async/dpdk/ethernet.cc)
   add_library(common_async_dpdk STATIC
     ${common_async_dpdk_files})
-  # to ready the dpdk header files
-  if(TARGET dpdk-ext)
-    add_dependencies(common_async_dpdk dpdk-ext)
-  endif()
   list(APPEND ceph_common_deps common_async_dpdk)
   target_link_libraries(common_async_dpdk
     ${DPDK_LIBRARIES})
-  set_target_properties(common_async_dpdk PROPERTIES
-    COMPILE_FLAGS "-march=native -I${DPDK_INCLUDE_DIR}")
 endif(WITH_DPDK)
 
 add_library(common STATIC ${ceph_common_objs})