[CMake] Compiling with openmpi installed from macports

Martin Pierre Hautefeuille mhaut at MIT.EDU
Tue Nov 19 20:23:43 EST 2013


Dear all,

I am trying to compile a piece of code, developed on Linux, on a Darwin system. I am using macports as a package manager with which I have installed openmpi. It seems that for some reasons, the mpi c compiler is not called mpicc when installed with macports but called openmpicc instead. Hence, the cmake command find_package(MPI) is unable to find the required mli library.

I pocked around on the internet and the best fix I have come up so far is as follows:
...
if(APPLE)
  set(MPI_C_COMPILER “openmpicc”)
endif(APPLE)
find_package(MPI)
…

Is there a better way to go about that?

Thanks a lot for your help!
Cheers,
Martin



More information about the CMake mailing list