From 31976eb16ce491c581fadfdc9b13f00467038137 Mon Sep 17 00:00:00 2001 From: s6anloes Date: Wed, 16 Oct 2024 12:57:05 +0100 Subject: [PATCH] Updated include dir path --- user/xrootd/module/CMakeLists.txt | 32 +++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/user/xrootd/module/CMakeLists.txt b/user/xrootd/module/CMakeLists.txt index 478b8cf21..809c24021 100644 --- a/user/xrootd/module/CMakeLists.txt +++ b/user/xrootd/module/CMakeLists.txt @@ -1,8 +1,36 @@ +# Try to locate XRootD automatically +find_path(XROOTD_INCLUDE_DIR XrdCl/XrdClFile.hh) +find_library(XRDCL_LIB XrdCl) + +# If XRootD is not found, allow the user to specify the directory manually +if (NOT XROOTD_INCLUDE_DIR OR NOT XRDCL_LIB) + message(WARNING "XRootD not found automatically. Please specify the XRootD directory using -DXROOTD_DIRECTORY=.") + + option(XROOTD_DIRECTORY "Path to the XRootD installation" "") + + if (XROOTD_DIRECTORY) + # Set include and library paths from the user-defined option + set(XROOTD_INCLUDE_DIR ${XROOTD_DIRECTORY}) + find_library(XRDCL_LIB XrdCl REQUIRED PATHS ${XROOTD_LIBRARY_DIR}) + + if (NOT EXISTS ${XROOTD_INCLUDE_DIR}/XrdCl/XrdClFile.hh) + message(FATAL_ERROR "Invalid XRootD directory: Header file not found in ${XROOTD_INCLUDE_DIR}.") + endif() + else() + message(FATAL_ERROR "XRootD not found and no directory specified. Please set -DXROOTD_DIRECTORY=.") + endif() +else() + message(STATUS "XRootD found automatically.") +endif() + +# Add include directory and link library +include_directories(${XROOTD_INCLUDE_DIR}) +link_directories(${XROOTD_LIBRARY_DIR}) + +# Add sources and library include_directories(include) aux_source_directory(src MODULE_SRC) -find_library(XRDCL_LIB XrdCl REQUIRED) - add_library(${EUDAQ_MODULE} SHARED ${MODULE_SRC}) target_link_libraries(${EUDAQ_MODULE} ${EUDAQ_CORE_LIBRARY} ${XRDCL_LIB})