CMake 3.6 & HDF5 COMPONENTS in C/CXX
In the HDF5 find module of the latest release of CMake (3.6.X+) the documentation states:
If the COMPONENTS argument is not given, the module will attempt to find only the C bindings.
this is wrong, since the default fallback chooses the global language: https://github.com/Kitware/CMake/blob/v3.6.2/Modules/FindHDF5.cmake#L116
if(NOT HDF5_FIND_COMPONENTS)
get_property(__langs GLOBAL PROPERTY ENABLED_LANGUAGES)
# ...
This causes compile issues such as
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
HDF5_hdf5_cpp_LIBRARY
when compiling a C++ project against the C bindings of HDF5 without setting the COMPONENTS C
in find(HDF5)
.
The HDF5 modules in CMake prior to 3.6 are not affected.