Warning, /EICrecon/cmake/FindVdt.cmake is written in an unsupported language. File is not indexed.
0001 # Wrapper around ROOT's FindVdt.cmake that resolves Spack view symlinks so that
0002 # the package-specific include path (under /opt/software/…/<hash>/) is used
0003 # instead of the merged view path (/opt/local/include).
0004 #
0005 # ROOT's FindVdt.cmake guards both find_library() and find_path() with "if(NOT
0006 # VDT_LIBRARY)" / "if(NOT VDT_INCLUDE_DIR)", so pre-setting these cache
0007 # variables here causes it to skip its own search and use our values.
0008
0009 # Step 1: find the library (may resolve to a spack-view symlink).
0010 if(NOT VDT_LIBRARY)
0011 find_library(VDT_LIBRARY NAMES vdt)
0012 endif()
0013
0014 # Step 2: resolve the library symlink to derive the real package prefix and
0015 # pre-set VDT_INCLUDE_DIR before ROOT's finder runs its find_path().
0016 if(VDT_LIBRARY AND NOT VDT_INCLUDE_DIR)
0017 # cmake-lint: disable=E1126
0018 file(REAL_PATH "${VDT_LIBRARY}" _vdt_real_lib)
0019 get_filename_component(_vdt_lib_dir "${_vdt_real_lib}" DIRECTORY)
0020 get_filename_component(_vdt_prefix "${_vdt_lib_dir}" DIRECTORY)
0021 set(VDT_INCLUDE_DIR
0022 "${_vdt_prefix}/include"
0023 CACHE PATH "Path to VDT include directory")
0024 unset(_vdt_prefix)
0025 unset(_vdt_lib_dir)
0026 unset(_vdt_real_lib)
0027 endif()
0028
0029 # Step 3: delegate version detection and target creation to ROOT's upstream
0030 # finder. It skips find_path/find_library because the variables are already
0031 # set. Fall back to a minimal implementation when ROOT is not yet available.
0032 if(DEFINED ROOT_CMAKE_DIR AND EXISTS "${ROOT_CMAKE_DIR}/modules/FindVdt.cmake")
0033 include("${ROOT_CMAKE_DIR}/modules/FindVdt.cmake")
0034 else()
0035 include(FindPackageHandleStandardArgs)
0036 find_package_handle_standard_args(Vdt REQUIRED_VARS VDT_INCLUDE_DIR
0037 VDT_LIBRARY)
0038 if(Vdt_FOUND AND NOT TARGET VDT::VDT)
0039 add_library(VDT::VDT UNKNOWN IMPORTED)
0040 target_include_directories(VDT::VDT SYSTEM INTERFACE "${VDT_INCLUDE_DIR}")
0041 set_target_properties(VDT::VDT PROPERTIES IMPORTED_LOCATION
0042 "${VDT_LIBRARY}")
0043 endif()
0044 endif()