From f945b9350f05846479f74d75de5c70a01d92ccb6 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Thu, 24 Mar 2022 15:47:56 -0700 Subject: Allow the path in which DPDK is installed to be specified. For autotools, if --with-dpdk={path} was specified, prepend {PATH}/pkgconfig to PKG_CONFIG_PATH before running pkg-config, and restore PKG_CONFIG_PATH afterwards. For CMake, if dpdk_ROOT is defined, prepend ${dpdk_ROOT}/pkgconfig to PKG_CONFIG_PATH before running pkg-config, and restore PKG_CONFIG_PATH afterwards. Fix some typoes in comments while we're at it. (cherry picked from commit 0a51499d12afc9f54d1d0690881873766bf9db02) --- cmake/Modules/Finddpdk.cmake | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'cmake') diff --git a/cmake/Modules/Finddpdk.cmake b/cmake/Modules/Finddpdk.cmake index 9eb8d1f6..d245fa0e 100644 --- a/cmake/Modules/Finddpdk.cmake +++ b/cmake/Modules/Finddpdk.cmake @@ -10,11 +10,11 @@ # We only try to find DPDK using pkg-config; DPDK is *SO* # complicated - DPDK 19.02, for example, has about 117(!) # libraries, and the precise set of libraries required has -# changed ver time - so attempting to guess which libraries +# changed over time - so attempting to guess which libraries # you need, and hardcoding that in an attempt to find the # libraries without DPDK, rather than relying on DPDK to # tell you, with a .pc file, what libraries are needed, -# is *EXTREELY* fragile and has caused some bug reports, +# is *EXTREMELY* fragile and has caused some bug reports, # so we're just not going to do it. # # If that causes a problem, the only thing we will do is @@ -24,8 +24,17 @@ # as pkg-config with *ALL* versions of DPDK that provide a # libdpdk.pc file). # +# If dpdk_ROOT is set, add ${dpdk_ROOT}/pkgconfig +# to PKG_CONFIG_PATH, so we look for the .pc file there, +# first. +# if(PKG_CONFIG_FOUND) + set(save_PKG_CONFIG_PATH $ENV{PKG_CONFIG_PATH}) + if(dpdk_ROOT) + set(ENV{PKG_CONFIG_PATH} "${dpdk_ROOT}/pkgconfig:$ENV{PKG_CONFIG_PATH}") + endif() pkg_check_modules(dpdk QUIET libdpdk) + set(ENV{PKG_CONFIG_PATH} "${save_PKG_CONFIG_PATH}") endif() mark_as_advanced(dpdk_INCLUDE_DIRS ${dpdk_LIBRARIES}) -- cgit v1.2.3