CMake 1.13.2 install problems

I’ve built 1.13.2 via CMake under Windows. When I try to use that after installing to a “custom” location, I get the following error when I try to use the hdf5-config.cmake from another CMake build:

CMake Error at hdf5-config.cmake:25 (message): File or directory %ProgramFiles%/HDF_Group/HDF5/1.13.2 referenced by variable HDF5_BUILD_DIR does not exist !

Looking at hdf5-config.cmake, I see a lot of references to ${PACKAGE_PREFIX_DIR}/%ProgramFiles%/HDF_Group/HDF5/1.13.2, which refers to an invalid location. The usage of %ProgramFiles% alone already seems erroneous to me - because that variable on my system at least contains C:\Program Files, meaning a directory prefix is appended to another directory prefix here; and the other subdirectories (HDF_Group/HDF5/1.13.2) also don’t necessarily exist.

This is a regression in comparison to 1.12.x, there the paths were all relative to ${PACKAGE_PREFIX_DIR} (i.e., if I replace all instances of ${PACKAGE_PREFIX_DIR}/%ProgramFiles%/HDF_Group/HDF5/1.13.2 with ${PACKAGE_PREFIX_DIR}, the build seems to work fine).

I can’t imagine any situation where the above frankenstein paths make sense, so I would suppose this is a bug?

This is a long-standing issue, that hasn’t quite been solved. The “%ProgramFiles%” should only be used as a default when no prefix is given. In actual use, it should not appear in any paths by default.

I think the failure happens at configure time - if you use our HDF5config.cmake file and do not specify a value for “INSTALLDIR”. Because that is the only file (HDF5_examples.cmake.in for building examples) that uses “%ProgramFiles%” for building HDF5.

See the INSTALL_CMake.txt file in release_docs.

1 Like

Thanks, that was it indeed!

Setting the INSTALLDIR fixes my problem!