From: Kefu Chai Date: Thu, 24 Oct 2019 06:10:32 +0000 (+0800) Subject: cmake: define dpdk_LIBRARIES properly X-Git-Tag: v15.1.0~1167^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=aa25f6202f8d2f75ac005382c69f4cf4001ebce3;p=ceph.git cmake: define dpdk_LIBRARIES properly 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 --- diff --git a/cmake/modules/Finddpdk.cmake b/cmake/modules/Finddpdk.cmake index 964ae5dfb0fe..fdb44ec61c71 100644 --- a/cmake/modules/Finddpdk.cmake +++ b/cmake/modules/Finddpdk.cmake @@ -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)