/usr/share/cmake/CheMPS2/FindTargetHDF5.cmake is in libchemps2-dev 1.8.5-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | # FindTargetHDF5.cmake
# --------------------
#
# HDF5 cmake module to wrap FindHDF5.cmake in a target.
#
# This module sets the following variables in your project: ::
#
# TargetHDF5_FOUND - true if HDF5 and all required components found on the system
# TargetHDF5_VERSION - HDF5 version in format Major.Minor.Release
# TargetHDF5_MESSAGE - status message with HDF5 library path list and version
#
# Note that components are passed along to find_package(HDF5 (untested) but not checked in the direct TargetHDF5Config
# Note that version checking/attaching not working yet
#
# This module *unsets* the following conventional HDF5 variables so as
# to force using the target: ::
#
# HDF5_FOUND
# HDF5_VERSION
# HDF5_INCLUDE_DIRS
# HDF5_LIBRARIES
#
# Exported targets::
#
# If HDF5 is found, this module defines the following :prop_tgt:`IMPORTED`
# target. ::
#
# tgt::hdf5 - the HDF5 libraries with headers attached.
#
# Suggested usage::
#
# find_package(TargetHDF5)
# find_package(TargetHDF5 1.8.16 REQUIRED)
#
#
# The following variables can be set to guide the search for this package::
#
# TargetHDF5_DIR - CMake variable, set to directory containing this Config file
# CMAKE_PREFIX_PATH - CMake variable, set to root directory of this package
set(PN TargetHDF5)
# 1st precedence - libraries passed in through -DHDF5_LIBRARIES
if (HDF5_LIBRARIES AND HDF5_INCLUDE_DIRS)
if (HDF5_VERSION)
if (NOT ${PN}_FIND_QUIETLY)
message (STATUS "HDF5 detection suppressed.")
endif()
add_library (tgt::hdf5 INTERFACE IMPORTED)
set_property (TARGET tgt::hdf5 PROPERTY INTERFACE_LINK_LIBRARIES ${HDF5_LIBRARIES})
set_property (TARGET tgt::hdf5 PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${HDF5_INCLUDE_DIRS})
set (${PN}_VERSION ${HDF5_VERSION})
else()
message (FATAL_ERROR "Humor the build system - pass in the version, too (for example, -DHDF5_VERSION=1.8.17).")
endif()
else()
# 2nd precedence - target already prepared and findable in TargetHDF5Config.cmake
find_package (TargetHDF5 QUIET CONFIG)
if ((TARGET tgt::hdf5) AND (${PN}_VERSION))
if (NOT ${PN}_FIND_QUIETLY)
message (STATUS "TargetHDF5Config detected.")
endif()
else()
# 3rd precedence - usual variables from FindHDF5.cmake
find_package (HDF5 QUIET COMPONENTS ${HDF5_FIND_COMPONENTS})
if (NOT ${PN}_FIND_QUIETLY)
message (STATUS "HDF5 detected.")
endif()
add_library (tgt::hdf5 INTERFACE IMPORTED)
set_property (TARGET tgt::hdf5 PROPERTY INTERFACE_LINK_LIBRARIES ${HDF5_LIBRARIES})
set_property (TARGET tgt::hdf5 PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${HDF5_INCLUDE_DIRS})
set (${PN}_VERSION ${HDF5_VERSION})
unset (HDF5_FOUND)
unset (HDF5_VERSION)
unset (HDF5_LIBRARIES)
unset (HDF5_INCLUDE_DIRS)
endif()
endif()
get_property(_ill TARGET tgt::hdf5 PROPERTY INTERFACE_LINK_LIBRARIES)
get_property(_iid TARGET tgt::hdf5 PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
set(${PN}_MESSAGE "Found HDF5: ${_ill} (found version ${${PN}_VERSION})")
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(${PN}
REQUIRED_VARS ${PN}_MESSAGE
VERSION_VAR ${PN}_VERSION)
|