The script FindHDF5.cmake is available since CMake 2.8. My software runs on various systems with either CMake 2.8 or 2.6.
When I use find_package(HDF5 REQUIRED) it works in 2.8 but of course not in 2.6. I was therefore thinking to copy FindHDF5.cmake in my project. But this is 1. ugly and 2. unmaintainable.
How do you handle such a situation ?
If you really need to use
then you should really require CMake 2.8 or later.
If you must run with CMake 2.6, then you should provide your own FindHDF5.cmake.
You can use conditional logic based on the CMake version if you must, such as:
However, the CMAKE_VERSION variable was not available until CMake 2.6.3, so you’ll have to require at least CMake 2.6.3 in order to use such a construct reliably.
See also: