aboutsummaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorGuy Harris <gharris@sonic.net>2022-03-24 15:47:56 -0700
committerGuy Harris <gharris@sonic.net>2022-03-24 16:12:24 -0700
commitf945b9350f05846479f74d75de5c70a01d92ccb6 (patch)
tree3bc3f3c56be674beaaf2c2d280b6545def2fef53 /cmake
parentb4eb8c47f67ae65f31a03628333bcf35c81616ab (diff)
downloadlibpcap-f945b9350f05846479f74d75de5c70a01d92ccb6.tar.gz
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)
Diffstat (limited to 'cmake')
-rw-r--r--cmake/Modules/Finddpdk.cmake13
1 files changed, 11 insertions, 2 deletions
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})