From be300380cec704b7337e7cb5137d29039067dd0f Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Fri, 20 Jul 2018 18:50:07 +0800 Subject: [PATCH] cmake: Finddpdk: add dpdk::${component} libs Signed-off-by: Kefu Chai --- cmake/modules/Finddpdk.cmake | 12 +++++++++--- src/CMakeLists.txt | 6 ------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/cmake/modules/Finddpdk.cmake b/cmake/modules/Finddpdk.cmake index 47abd1fe57b..aff4b47e050 100644 --- a/cmake/modules/Finddpdk.cmake +++ b/cmake/modules/Finddpdk.cmake @@ -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}) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e3e97144170..a0988cf9c66 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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}) -- 2.39.5