From f8d7e1fd1b7c5aaffdcf25c810d8d66fcea674f5 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Wed, 11 Dec 2024 17:05:02 +0100 Subject: [PATCH] Findxran: exclude default paths, use hints Some users copy libxran.so to a system directory (e.g., /usr/local/lib). At the same time, we require xran_LOCATION to be set to find the build directory. Use HINTS to prefer the location passed through xran_LOCATION. Also, use NO_DEFAULT_PATH to outright disallow global scope, to prevent "accidentally" finding libxran.so in global scope (this is for multi-user systems that are used in development, and where people have different version of libxran for testing purposes). To still use packages in e.g., /usr/local/, it would be possible to set xran_LOCATION to this directory. (there is a problem that the version information will likely not be read correctly, so this might not be enough) --- cmake_targets/tools/MODULES/Findxran.cmake | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/cmake_targets/tools/MODULES/Findxran.cmake b/cmake_targets/tools/MODULES/Findxran.cmake index 39f0ffeb75..290a782350 100644 --- a/cmake_targets/tools/MODULES/Findxran.cmake +++ b/cmake_targets/tools/MODULES/Findxran.cmake @@ -83,12 +83,15 @@ find_path(xran_INCLUDE_DIR xran_pkt.h xran_pkt_up.h xran_sync_api.h - PATHS ${xran_LOCATION} - PATH_SUFFIXES api + HINTS ${xran_LOCATION} + PATH_SUFFIXES api include + NO_DEFAULT_PATH ) find_library(xran_LIBRARY NAMES xran - PATHS ${xran_LOCATION}/build + HINTS ${xran_LOCATION} + PATH_SUFFIXES build api + NO_DEFAULT_PATH ) if (NOT xran_LIBRARY) message(FATAL_ERROR "could not detect xran build artifacts at ${xran_LOCATION}/build")