Can not use parallel target in CMake in pure C++ project #3844
Labels
Component - Build
CMake, Autotools
Priority - 1. High 🔼
These are important issues that should be resolved in the next release
Type - Bug / Bugfix
Please report security issues to help@hdfgroup.org instead of creating an issue on GitHub
Describe the bug
When trying to link against the parallel HDF5 target in CMake in a C++ project, CMake complains that the MPI_C target is not found:
This is related to but distinct from the bug addressed by #2400. The reason for the error is that the project only enables the C++ language and CMake therefore does not import the MPI_C target. (Presumably there would be a similar issue in Fortran projects.) Adding
enable_language(C)
before importing the HDF5 package fixes the problem.Expected behavior
Parallel HDF5 imports the MPI::MPI_C package to satisfy its public dependency.
Platform (please complete the following information)
set(HDF5_PREFER_PARALLEL TRUE)
HDF5 and its dependencies were compiled using Spack v0.20.3.
The text was updated successfully, but these errors were encountered: