diff --git a/backends/ebpf/CMakeLists.txt b/backends/ebpf/CMakeLists.txt index b1154c7e62..a04b0e398a 100644 --- a/backends/ebpf/CMakeLists.txt +++ b/backends/ebpf/CMakeLists.txt @@ -262,7 +262,7 @@ if(TEST_DEPENDENCY_PRESENT) # We do not have support for dynamic addition of tables in the test framework p4c_add_test_with_args("ebpf" ${EBPF_DRIVER_TEST} TRUE "testdata/p4_16_samples/ebpf_conntrack_extern.p4" "testdata/p4_16_samples/ebpf_conntrack_extern.p4" "--extern-file ${P4C_SOURCE_DIR}/testdata/extern_modules/extern-conntrack-ebpf.c" "") else() - message(WARNING "Skipped adding Tests due to missing dependencies" "Please install the dependencies and try again") + message(WARNING "Skipped adding Tests due to missing dependencies" " Please install the dependencies and try again") endif() message(STATUS "Done with configuring BPF back end") diff --git a/cmake/P4CUtils.cmake b/cmake/P4CUtils.cmake index 944e1b8b7e..68c19854df 100644 --- a/cmake/P4CUtils.cmake +++ b/cmake/P4CUtils.cmake @@ -421,7 +421,11 @@ function(get_all_targets _result _dir) set(${_result} ${${_result}} ${_sub_targets} PARENT_SCOPE) endfunction() -# Checks for presence of programs and dependencies +# Checks for presence of programs and dependencies +# This function supports a optional parameter HINTS_DIRS. +# In case cmake is unable to find a library even if it is present, +# you can pass the exact directory path as the last parameter of this function. +# Eg. CHECK_DEPENDENCIES(VAR "${TEST_PROGRAMS}" "${TEST_LIBRARIES}" "${HINTS_DIRS}") function(CHECK_DEPENDENCIES OUT_VAR TEST_DEPENDENCY_PROGRAMS TEST_DEPENDENCY_LIBRARIES) set(ALL_FOUND TRUE) @@ -437,7 +441,13 @@ function(CHECK_DEPENDENCIES OUT_VAR TEST_DEPENDENCY_PROGRAMS TEST_DEPENDENCY_LIB endforeach() foreach(LIB ${TEST_DEPENDENCY_LIBRARIES}) - find_library(LIB_PATH ${LIB} HINTS "${CMAKE_CURRENT_SOURCE_DIR}/runtime/usr/lib64/") + if (ARGC GREATER 3) + set(HINTS_DIRS_ARG ${ARGV4}) + find_library(LIB_PATH ${LIB} HINTS ${HINTS_DIRS}) + else() + find_library(LIB_PATH ${LIB}) + endif() + if (NOT LIB_PATH) message(WARNING "Missing library ${LIB}." " Please install ${LIB}.")