Use `find_package` in CMake to find the MPI package.
Use find_package
to find the MPI package with CMake.
Link MPI executables with the MPI target to compile them with MPI, rather than using mpicc
or mpicxx
.
Use ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 4 ${MPIEXEC_PREFLAGS} $<TARGET_FILE:my_test_executable> ${MPIEXEC_POSTFLAGS}
as the test command to run the executable.
Add --oversubscribe
to use more processes than you have cores!