netcdf: use -lmpi if hdf5 was built with mpi
netcdf: use -lmpi if hdf5 was built with mpi

Also,

- fix formula bugs in the new CMake-based formula
- use configure with the cxx-compat resource since there is no CMake-based build
  system for that option at this time

Closes #4955.

Signed-off-by: ilovezfs <fbd54dbbcf9e596abad4ccdc4dfc17f80ebeaee2@icloud.com>

pditommaso/homebrew-science,heuermh/homebrew-science,philippbayer/homebrew-science,dpo/homebrew-science,andrewjpage/homebrew-science,maplesond/homebrew-science,quantumsteve/homebrew-science