Thanks for t he detailed instructions!
I have now tried building via CMake directly from github source. I also realized that at the moment I really only need zlib support, sz is I think not that important for us.
So I left out the sz/aec-related options, and tried:
cmake -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING="TGZ" -DTGZPATH:PATH="C:/Tools/hdf5"
-DBUILD_SHARED_LIBS:BOOL=OFF -DHDF5_BUILD_TOOLS:BOOL=OFF
-DHDF5_BUILD_UTILS:BOOL=OFF -DBUILD_TESTING:BOOL=OFF
-DHDF5_BUILD_EXAMPLES:BOOL=OFF -DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=ON
-DHDF5_ENABLE_SZIP_SUPPORT:BOOL=OFF -DZLIB_TGZ_NAME:STRING=zlib-1.3.1.tar.gz
-DZLIB_USE_LOCALCONTENT:BOOL=ON ..\src.git
zlib-1.3.1.tar.gz is downloaded directly from Releases · madler/zlib · GitHub
but I am getting an error:
CMake Error at config/cmake/HDFLibMacros.cmake:36 (add_library):
add_library cannot create ALIAS target "zlib-static" because another target
with the same name already exists.
Call Stack (most recent call first):
CMakeFilters.cmake:85 (EXTERNAL_ZLIB_LIBRARY)
CMakeLists.txt:870 (include)
CMake Warning at CMakeFilters.cmake:107 (message):
ZLib support in HDF5 was enabled but not found
Call Stack (most recent call first):
CMakeLists.txt:870 (include)
EDIT:
Using the HDFOptions.cmake file you just need to add/edit these options
That file only exists in the released CMake-hdf5-x.y.z.tar.gz files, right? Basically I was trying to do this in my previous tries (see my first post), but couldn’t get it to work the way I want, and the way I previously remember it working: that it automatically built zlib (and sz) and also provided those dependent libraries along with the exported CMake targets.
I did get a working build by building zlib myself; with HDF5 configured with these options:
-DZLIB_DIR:PATH=C:/Tools/hdf5/zlib/install/cmake (the cmake folder under where I installed the self-built zlib)
-DZLIB_USE_EXTERNAL:BOOL=0
-DBUILD_TESTING:BOOL=0
-DHDF5_BUILD_TOOLS:BOOL=0
-DHDF5_BUILD_EXAMPLES:BOOL=0
-DHDF5_BUILD_UTILS:BOOL=0
-DZLIB_USE_EXTERNAL:BOOL=0
-DBUILD_SHARED_LIBS:BOOL=0
(Note: not sure what ZLIB_USE_EXTERNAL actually means here - I do use an externally built zlib, but I still need to turn it off, otherwise I get a message saying that zlib is turned on but not properly configured…)
Downside then is that in my build I need to manually link to zlib (and also hdf5 doesn’t seem to create the hdf5::hdf5-static alias, I need to link to hdf5-static). So there seems to some automatism in place that puts together a combined hdf5+zlib “release” (at least that was the case before when I was using the CMake-hdf5-x.y.z.tar.gz sources), but that doesn’t seem to happen when building “manually” directly from the hdf5 sources?
