InsightSoftwareConsortium / InsightSoftwareConsortium/ITK
CMake attempts to set properties on hdf5-static instead of hdf5-shared when BUILD_STATIC_LIBS is set to OFF
- Dominant language
- C++
- Stars
- 1.7k
- Forks
- 748
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 64
Description
### Description
CMake attempts to properties on `hdf5-static` instead of `hdf5-shared` when `BUILD_STATIC_LIBS` is set to `OFF`
https://github.com/InsightSoftwareConsortium/ITK/blob/15af3aed65693811448c9af22ce9d09ff9f3000a/Modules/ThirdParty/HDF5/CMakeLists.txt#L84
The test to decide if it is shared or static is performed on `BUILD_SHARED_LIBS`, perhaps it should be done on `BUILD_STATIC_LIBS` ?
If one manually set `BUILD_SHARED_LIBS` to `ON` in the CMake cache, it fixes the issue.
### Steps to Reproduce
1. Configure CMake with `BUILD_STATIC_LIBS` set to `OFF`
2. Get:
```CMake Error at CMake/ITKModuleMacros.cmake:410 (set_property):
set_property could not find TARGET hdf5-static.
Perhaps it has not yet been created.
Call Stack (most recent call first):
CMake/ITKModuleMacros.cmake:464 (itk_module_target_name)
Modules/ThirdParty/HDF5/src/CMakeLists.txt:106 (itk_module_target)
```
### Versions
v5.4.0
### Environment
CMake 3.29.6
Contributor guide
Assessment
This issue has not been assessed yet.