From: Kefu Chai Date: Fri, 20 Jul 2018 10:50:07 +0000 (+0800) Subject: cmake: Finddpdk: add dpdk::${component} libs X-Git-Tag: v14.0.1~807^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=be300380cec704b7337e7cb5137d29039067dd0f;p=ceph-ci.git cmake: Finddpdk: add dpdk::${component} libs Signed-off-by: Kefu Chai --- 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})