FindHDF5: Restore parallel HDF5 detection with only CXX enabled

Since commit 14c46fb16a (FindHDF5: Find C component with only CXX
compiler, 2022-12-13, v3.26.0-rc1~175^2), if CXX is enabled but C is
not, the `_HDF5_test_regular_compiler_C` helper writes a `.cpp` source
but the `_HDF5_invoke_compiler` still expects a `.c` source.  Refactor
the logic to select a name for the source file up front, and use it in
both helpers.

Fixes: #24627
Issue: #24241
1 file changed