Missing HDF5_DIR error when building examples on Windows

I am attempting to build the example tests for HDF5 1.14.1 in Windows. I installed HDF5 from a precompiled binary using all default settings. I followed the instructions in USING_CMake_Examples.txt. Then I opened Intel oneAPI command prompt for Visual Studio 2019 and navigated to the test_hdf5 directory. When I run the ctest command, I see this

  • Extra verbosity turned on
    Reading Script: C:/Users/me/netCDF/test_hdf5/HDF5_Examples.cmake,CTEST_SOURCE_NAME=HDF5Examples,INSTALLDIR=C:/Program Files/HDF_Group/HDF5/1.14.1
    Add coverage exclude regular expressions.
    SetCTestConfiguration:SourceDirectory:C:/Users/me/netCDF/test_hdf5/HDF5Examples
    SetCTestConfiguration:BuildDirectory:C:/Users/me/netCDF/test_hdf5/HDF5Examples/build
    Run dashboard with model Experimental
    Source directory: C:/Users/me/netCDF/test_hdf5\HDF5Examples
    Build directory: C:/Users/me/netCDF/test_hdf5\HDF5Examples\build
    Reading ctest configuration file: C:/Users/me/netCDF/test_hdf5/HDF5Examples/CTestConfig.cmake
    SetCTestConfigurationFromCMakeVariable:NightlyStartTime:CTEST_NIGHTLY_START_TIME
    SetCTestConfiguration:NightlyStartTime:18:00:00 CST
    SetCTestConfigurationFromCMakeVariable:Site:CTEST_SITE
    SetCTestConfiguration:Site:local
    SetCTestConfigurationFromCMakeVariable:BuildName:CTEST_BUILD_NAME
    SetCTestConfiguration:BuildName:Windows–
    Site: local
    Build name: Windows–
    Add coverage exclude regular expressions.
    Use Experimental tag: 20230810-2107
    SetCTestConfiguration:BuildDirectory:C:/Users/me/netCDF/test_hdf5/HDF5Examples/build
    SetCTestConfiguration:SourceDirectory:C:/Users/me/netCDF/test_hdf5/HDF5Examples
    SetCTestConfiguration:ConfigureCommand:“C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/bin/cmake.exe” -C “C:/Users/me/netCDF/test_hdf5\HDF5Examples/config/cmake/cacheinit.cmake” -DCMAKE_BUILD_TYPE:STRING=Release -DCTEST_CONFIGURATION_TYPE:STRING=Release -DSITE:STRING=local -DBUILDNAME:STRING=examples -DHDF5_ROOT:PATH=C:/Program Files/HDF_Group/HDF5/1.14.1 -DHDF5_PACKAGE_NAME:STRING=hdf5 -DHDF5_NAMESPACE:STRING=hdf5:: -DSITE:STRING=local -DBUILDNAME:STRING=Windows-- -DCTEST_USE_LAUNCHERS:BOOL=OFF “-GVisual Studio 16 2019” “” “” “C:/Users/me/netCDF/test_hdf5\HDF5Examples”
    Configure project
    Configure with command: “C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/bin/cmake.exe” -C “C:/Users/me/netCDF/test_hdf5\HDF5Examples/config/cmake/cacheinit.cmake” -DCMAKE_BUILD_TYPE:STRING=Release -DCTEST_CONFIGURATION_TYPE:STRING=Release -DSITE:STRING=local -DBUILDNAME:STRING=examples -DHDF5_ROOT:PATH=C:/Program Files/HDF_Group/HDF5/1.14.1 -DHDF5_PACKAGE_NAME:STRING=hdf5 -DHDF5_NAMESPACE:STRING=hdf5:: -DSITE:STRING=local -DBUILDNAME:STRING=Windows-- -DCTEST_USE_LAUNCHERS:BOOL=OFF “-GVisual Studio 16 2019” “” “” “C:/Users/me/netCDF/test_hdf5\HDF5Examples”
    Run command: “C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/bin/cmake.exe” “-C” “C:/Users/me/netCDF/test_hdf5\HDF5Examples/config/cmake/cacheinit.cmake” “-DCMAKE_BUILD_TYPE:STRING=Release” “-DCTEST_CONFIGURATION_TYPE:STRING=Release” “-DSITE:STRING=local” “-DBUILDNAME:STRING=examples” “-DHDF5_ROOT:PATH=C:/Program” “Files/HDF_Group/HDF5/1.14.1” “-DHDF5_PACKAGE_NAME:STRING=hdf5” “-DHDF5_NAMESPACE:STRING=hdf5::” “-DSITE:STRING=local” “-DBUILDNAME:STRING=Windows–” “-DCTEST_USE_LAUNCHERS:BOOL=OFF” “-GVisual Studio 16 2019” “” “” “C:/Users/me/netCDF/test_hdf5\HDF5Examples”
    loading initial cache file C:/Users/me/netCDF/test_hdf5\HDF5Examples/config/cmake/cacheinit.cmake
    – Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19044.
    – The C compiler identification is MSVC 19.29.30151.0
    – The CXX compiler identification is MSVC 19.29.30151.0
    – Detecting C compiler ABI info
    – Detecting C compiler ABI info - done
    – Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe - skipped
    – Detecting C compile features
    – Detecting C compile features - done
    – Detecting CXX compiler ABI info
    – Detecting CXX compiler ABI info - done
    – Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe - skipped
    – Detecting CXX compile features
    – Detecting CXX compile features - done
    – HDF5 find comps: C;shared
    – Could NOT find HDF5 (missing: HDF5_DIR)
    – HDF5 C libs:0 static: and shared:
    – HDF5 Fortran libs: static: and shared:
    – HDF5 Java libs:
    – Could NOT find HDF5 (missing: HDF5_LIBRARIES HDF5_INCLUDE_DIRS) (found version “”)
    CMake Error at config/cmake/HDFExampleMacros.cmake:279 (message):
    HDF5 is Required for HDF5 Examples
    Call Stack (most recent call first):
    CMakeLists.txt:24 (HDF5_SUPPORT)

– Configuring incomplete, errors occurred!

System configuration:
Windows 10 x64
cmake 3.20.21032501-MSVC_2
Visual Studio 2019 16.11.28

What am I missing here? Thanks

Did the command line set the INSTALLDIR? The default may not be correct for your installation.
(see line 67 in the USING_CMake_Examples.txt file)

I tried setting it explicitly, but no luck.

ctest -S HDF5_Examples.cmake,CTEST_SOURCE_NAME=HDF5Examples,INSTALLDIR=“C:\Program Files\HDF_Group\HDF5\1.14.1” -C Release -VV -O test.log

Well, INSTALLDIR is used in line 84 of the HDF5_Examples.cmake file, so it should be in the CMakeCache.txt file in the build dir. Also can you show the top of the log that should show the actual command line that gets invoked after all the script settings are finished. It should be output before what you have posted?

BTW, the “skipped” are not errors, just CMake reporting that it has the compiler information and does not need to go exploring for the compiler. The error is “Could NOT find HDF5 (missing: HDF5_DIR)”

One thing I noticed for later, is that you mention the OneAPI compiler but there is not an option set for using that toolset, so you will be just using the installed MSVC compiler.

Ok, I edited my first post to show more of the output.
I don’t see anything about INSTALLDIR in the CMakeCache.txt file.

Sorry, left out the actual: HDF5_ROOT:PATH which looks correct. Except for the space in :slight_smile: “-DHDF5_ROOT:PATH=C:/Program” “Files/HDF_Group/HDF5/1.14.1”

The space gets separated. Try adding quotes around it in the INSTALLDIR=“path”

Wow, good catch. But I’m not sure how to fix it, since that is the output from using quotes already. It looks like the path was interpreted correctly in the “Configure with command” but not the “Run command”.

CMake is wierd with spaces. Try doubleing the quotes INSTALLDIR=““path””

OR you could try using the ENV variable instead of “Program Files”

The thing that works (and I think is mentioned in the docs) is to install hdf5 in a path without spaces.

Ok, neither of those workarounds worked so I will see about reinstalling the library to a different path. Hopefully that will take care of it. Thank you