An HDF5 equivalent of `CMAKE_EXE_LINKER_FLAGS`?
- Dominant language
- C
- Stars
- 988
- Forks
- 355
- Avg merge
- 4d 2h
- Merged PRs (30d)
- 12
Description
**Is your feature request related to a problem? Please describe.**
This came up when I was trying to generate `gprof` profiling data from `h5repack`. Obtaining `gprof` output requires to build and link statically the library and its tools with the specific command-line option `-pg`. I used this custom CMake preset:
```json
{
"name": "my-profiling-arm64-Linux",
"description": "To gather performance profiling data.",
"inherits": [
"ci-arm64",
"ci-GNUC",
"ci-Release",
"ci-StdCompression"
],
"cacheVariables": {
"HDF5_BUILD_DOC": {"type": "BOOL", "value": "OFF"},
"HDF5_BUILD_EXAMPLES": {"type": "BOOL", "value": "OFF"},
"HDF5_USE_ZLIB_NG": {"type": "BOOL", "value": "ON"},
"HDF5_ENABLE_SZIP_SUPPORT": {"type": "BOOL", "value": "OFF"},
"BUILD_SHARED_LIBS": {"type": "BOOL", "value": "OFF"},
"HDF5_ENABLE_PROFILING": {"type": "BOOL", "value": "ON"},
"PROFILE_CFLAGS": {"type": "STRING", "value": "-pg"},
"CMAKE_EXE_LINKER_FLAGS": {"type": "STRING", "value": "-pg"}
}
}
```
Without setting the `CMAKE_EXE_LINKER_FLAGS` variable, there was no `gprof` output.
**Describe the solution you'd like**
Perhaps the HDF5's CMake system should have an equivalent of `CMAKE_EXE_LINKER_FLAGS`. I experimented with the `CMAKE_STATIC_LINKER_FLAGS` which prevented building the zlib-ng library as the DEFLATE fiter, so a custom HDF5 variable may allow better control of where user-specified linker options are applied.
Contributor guide
Assessment
This issue has not been assessed yet.