FindHDF5 ignores preset HDF5_DIR
Setting HDF5_DIR
has no effect. This might be because FindHDF5.cmake only checks HDF5_ROOT
when trying to find a CONFIG version:
if(HDF5_ROOT)
set(_HDF5_SEARCH_OPTS NO_DEFAULT_PATH)
else()
set(_HDF5_SEARCH_OPTS)
endif()
# Try to find HDF5 using an installed hdf5-config.cmake
if(NOT HDF5_FOUND AND NOT HDF5_NO_FIND_PACKAGE_CONFIG_FILE)
find_package(HDF5 QUIET NO_MODULE
HINTS "${HDF5_ROOT}"
${_HDF5_SEARCH_OPTS}
)
...
Nevertheless, even when setting HDF5_ROOT
(or when changing the above code) the above find_package
only finds my system-version of hdf5-config.cmake
(i.e., the one installed in c:\Program Files
) and refuses to find my own installed version whatever I do with HDF5_ROOT
and HDF5_DIR
(I tried on Windows with CMake 3.9-rc5).
If I remove the QUIET
option in the find_package
statement above, I get the confusing message
Could NOT find HDF5 (missing: HDF5_DIR)
even if HDF5_DIR is set.
It seems that I still don't understand find_package and Config files...