install error

In a github action for building our project (which requires ITK), I’m getting a strange error trying to install ITK 5.4:

CMake Error at Modules/ThirdParty/HDF5/src/itkhdf5/hl/c++/src/cmake_install.cmake:55 (file):
  file INSTALL cannot find
  "...../itk/bin-5.4.0/bin/Release/hdf5_hl_cpp-shared.dll":
  File exists.

This only happens on the Windows platform, there is no error on Linux.

Does anybody have a quick idea about what might go wrong here? The error message is kind of contradictory - “cannot find file … file exists”? maybe the file is copied twice but the second copying checks whether the file already existsi and won’t overwrite?

I don’t usually install ITK, I typically use it from the build folder. It is no surprise that I don’t remember that error message.

If you typically install ITK, is it easy for you to try whether PR 5167 adversely affects installation? It is the only thing left to test before merging it.

I don’t usually install ITK, I typically use it from the build folder.

That will be the next thing I’ll try. I typically do it like this too - but in previous experiments there was limited space available in the github actions runner, so I tried to reduce the used storage through installing (vtk &) itk, and removing source and binary folders. Also, it has made caching easier and more efficient.

If you typically install ITK, is it easy for you to try whether PR 5167 adversely affects installation?

This has been the first time I successfully experimented with installing itk, so no, sorry, I am not really qualified to test this!

Some further research - the contradictory message cannot find ... file exists seems to be a CMake bug.

From the logs, it looks as though the install command actually uses the wrong file name. The library actually created during build is called bin-5.4.0/bin/Release/itkhdf5_cpp-shared-5.4.dll, but the file that the INSTALL command looks for is called bin-5.4.0/bin/Release/hdf5_hl_cpp-shared.dll. So it’s missing the itk prefix, and the -5.4 suffix.

In my local build of ITK 5.4, I do not have the Modules/ThirdParty/HDF5/src/itkhdf5/hl/c++/src/cmake_install.cmake, it is probably created on the fly during install?

I also see a bunch of CMake configure warnings related to hdf5, not sure if they could be related:

CMake Warning (dev) at Modules/ThirdParty/HDF5/src/itkhdf5/src/CMakeLists.txt:1095 (add_custom_command):
  The following keywords are not supported when using
  add_custom_command(TARGET): DEPENDS.

  Policy CMP0175 is not set: add_custom_command() rejects invalid arguments.
  Run "cmake --help-policy CMP0175" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at Modules/ThirdParty/HDF5/src/itkhdf5/src/CMakeLists.txt:1107 (add_custom_command):
  The following keywords are not supported when using
  add_custom_command(TARGET): DEPENDS.

  Policy CMP0175 is not set: add_custom_command() rejects invalid arguments.
  Run "cmake --help-policy CMP0175" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at Modules/ThirdParty/HDF5/src/itkhdf5/src/CMakeLists.txt:1176 (add_custom_command):
  The following keywords are not supported when using
  add_custom_command(TARGET): DEPENDS.

  Policy CMP0175 is not set: add_custom_command() rejects invalid arguments.
  Run "cmake --help-policy CMP0175" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at Modules/ThirdParty/HDF5/src/itkhdf5/src/CMakeLists.txt:1188 (add_custom_command):
  The following keywords are not supported when using
  add_custom_command(TARGET): DEPENDS.

  Policy CMP0175 is not set: add_custom_command() rejects invalid arguments.
  Run "cmake --help-policy CMP0175" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.
This warning is for project developers.  Use -Wno-dev to suppress it.