CMake build inconsistencies
Describe the bug There are differences in the file layout between the CMake build and the autotools build The results obtained from autotools make more sense.
Expected behavior The file layout resulting from both build tools should be the same
Platform (please complete the following information)
- HDF5 version: 1.14.4.2
- OS and version: Arch Linux (rolling)
- Compiler and version: GCC 14.1.1
- Build system (e.g. CMake, Autotools): both, CMake in version 1.14.4.2
- Any configure options you specified
- MPI library and version (parallel HDF5): n/a
Additional context Build instructions are:
cmake -S hdf5-hdf5_1.14.4.2 \
-B build \
-DCMAKE_INSTALL_PREFIX=/usr \
-DBUILD_STATIC_LIBS=OFF \
-DCMAKE_BUILD_TYPE=Release \
-DHDF5_BUILD_HL_LIB=ON \
-DHDF5_BUILD_CPP_LIB=ON \
-DHDF5_BUILD_FORTRAN=ON \
-DHDF5_BUILD_JAVA=ON \
-DHDF5_ENABLE_Z_LIB_SUPPORT=ON \
-DHDF5_ENABLE_SZIP_SUPPORT=ON \
-DHDF5_ENABLE_SZIP_ENCODING=ON \
-DUSE_LIBAEC=ON
make -C build \
cmake --install build
cd hdf5-hdf5_1.14.4.2
./configure \
--prefix=/usr \
--docdir=/usr/share/doc/hdf5/ \
--with-examplesdir=/usr/share/doc/hdf5/examples/ \
--disable-static \
--disable-sharedlib-rpath \
--enable-build-mode=production \
--enable-hl \
--enable-cxx \
--enable-fortran \
--enable-java \
--with-pic \
--with-zlib \
--with-szlib
make
make install
With CMake, there is a folder mod in /usr that contains Fortran module files. Having module files in this folder is uncommon.
Also, the example files in /usr/share/doc/hdf5 are missing when using CMake even though HDF5_BUILD_EXAMPLES is set to ON by default.
With CMake, there is a folder mod in /usr that contains Fortran module files. Having module files in this folder is uncommon.
CMake provides more options for customizing then the Autotools builds.
The fortran mod files are binary objects. However the CMake build gives the option to rename the folder with HDF5_INSTALL_MODULE_DIR or copy either the shared or static mods to the include folder with HDF5_INSTALL_MOD_FORTRAN.
CMake default for HDF5_BUILD_EXAMPLES corresponds to default CMake convention.
CMake default for HDF5_BUILD_EXAMPLES corresponds to default CMake convention.
Where can I find the examples? autotools installs them to /usr/share/doc/hdf5/examples/ but I can't find them there when using CMake.
The fortran mod files are binary objects. However the CMake build gives the option to rename the folder with HDF5_INSTALL_MODULE_DIR or copy either the shared or static mods to the include folder with HDF5_INSTALL_MOD_FORTRAN.
But what is the rational to have some in /usr/mod/shared (where I, as a Fortran developer, would never search for them) and others into the more common location /usr/include?
Because with some compilers shared and static mod files are different, we allow you to choose.
examples, doxygen and such are in the install location under the share folder. Have tried setting: option (HDF5_USE_GNU_DIRS "ON to use GNU Coding Standard install directory variables, OFF to use historical settings" OFF)
CMake has more options then autotools handled across more platforms and different build systems. The default options produce an installation image that is compact and consistent with CMake conventions. Some of the perceived oddities can be changed with HDF5 and CMake options. There will always be compromises because CMake needs to work with a number of build systems, platforms, compilers and settings.