]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
cmake: define dpdk_LIBRARIES properly
authorKefu Chai <kchai@redhat.com>
Thu, 24 Oct 2019 06:10:32 +0000 (14:10 +0800)
committerKefu Chai <kchai@redhat.com>
Thu, 24 Oct 2019 07:15:51 +0000 (15:15 +0800)
dpdk_LIBRARIES should not be a list of dpdk library target, it should be
a list of paths to them. this also align with the definition of
`Finddpdk.cmake` in seastar project. so, if `Seastar_DPDK` is defined,
we should be able to offer the expected `dpdk_LIBRARIES` for seastar, as
our `Finddpdk.cmake` has higher priority than the one in seastar, and is
used when `find_package(dpdk...)` is called.

Signed-off-by: Kefu Chai <kchai@redhat.com>
cmake/modules/Finddpdk.cmake

index 964ae5dfb0fe5efbe3466ae03870db5ecb0700ac..fdb44ec61c71cb36fe4a8f82db90bc4ed906d3af 100644 (file)
@@ -2,6 +2,7 @@
 #
 # Once done, this will define
 #
+# dpdk::dpdk
 # dpdk_FOUND
 # dpdk_INCLUDE_DIR
 # dpdk_LIBRARIES
@@ -51,6 +52,9 @@ set(components
   pmd_vmxnet3_uio
   ring)
 
+# for collecting dpdk library targets, it will be used when defining dpdk::dpdk
+set(_dpdk_libs)
+# for list of dpdk library archive paths
 set(dpdk_LIBRARIES)
 
 foreach(c ${components})
@@ -73,7 +77,8 @@ foreach(c ${components})
         endif()
       endif()
     endif()
-    list(APPEND dpdk_LIBRARIES ${dpdk_lib})
+    list(APPEND _dpdk_libs ${dpdk_lib})
+    list(APPEND dpdk_LIBRARIES ${DPDK_rte_${c}_LIBRARY})
   endif()
 endforeach()
 
@@ -103,11 +108,13 @@ if(dpdk_FOUND)
   if(NOT TARGET dpdk::dpdk)
     add_library(dpdk::dpdk INTERFACE IMPORTED)
     find_package(Threads QUIET)
-    list(APPEND dpdk_LIBRARIES
+    list(APPEND _dpdk_libs
       Threads::Threads
       dpdk::cflags)
     set_target_properties(dpdk::dpdk PROPERTIES
-      INTERFACE_LINK_LIBRARIES "${dpdk_LIBRARIES}"
+      INTERFACE_LINK_LIBRARIES "${_dpdk_libs}"
       INTERFACE_INCLUDE_DIRECTORIES "${dpdk_INCLUDE_DIRS}")
   endif()
 endif()
+
+unset(_dpdk_libs)