From aa25f6202f8d2f75ac005382c69f4cf4001ebce3 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Thu, 24 Oct 2019 14:10:32 +0800 Subject: [PATCH] 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 --- cmake/modules/Finddpdk.cmake | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/cmake/modules/Finddpdk.cmake b/cmake/modules/Finddpdk.cmake index 964ae5dfb0f..fdb44ec61c7 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) -- 2.39.5