[CMake] FindMPI and setting C/C++ compiler

Marcel Loose loose at astron.nl
Wed May 26 12:11:11 EDT 2010


Yeah, I know that works.

But if that's the "proper" solution, then what's the use of FindMPI
anyways?

Regards,
Marcel Loose.

On Wed, 2010-05-26 at 11:53 -0400, Dave Partyka wrote:
> The way I have accomplished this is to:
> 
> 
> export CC=mpicc
> export CXX=mpicxx
> 
> 
> blow away your build tree and then re-configure re-generate
> 
> On Wed, May 26, 2010 at 11:38 AM, Michael Wild <themiwi at gmail.com>
> wrote:
>         
>         On 26. May, 2010, at 17:20 , Marcel Loose wrote:
>         
>         > Hi all,
>         >
>         > I was wondering how one should use find_package(MPI) to
>         properly set the
>         > C/C++ compiler(s). Normally, you call find_package() after
>         the project()
>         > command. However, by that time the CMAKE_<LANG>_COMPILER
>         cache variables
>         > have already been set. Should one FORCE these cache
>         variables to the
>         > value of MPI_COMPILER?
>         >
>         > I vaguely remember that setting CMAKE_<LANG>_COMPILER after
>         the
>         > project() statement was a definite no-no, because all kinds
>         of tests,
>         > executed by the project() command, are done with the default
>         C/C++
>         > compilers.
>         >
>         > Best regards,
>         > Marcel Loose.
>         
>         
>         
>         Usually mpiCC and cohorts are just wrapper scripts which add
>         appropriate include directories and libraries to the command
>         line. If I remember correctly, FindMPI.cmake detects those and
>         provides them via MPI_COMPILE_FLAGS, MPI_INCLUDE_PATH,
>         MPI_LINK_FLAGS and MPI_LIBRARIES. So, you actually don't need
>         to set the compiler to one of the MPI compiler wrappers.
>         
>         Michael
>         
>         _______________________________________________
>         Powered by www.kitware.com
>         
>         Visit other Kitware open-source projects at
>         http://www.kitware.com/opensource/opensource.html
>         
>         Please keep messages on-topic and check the CMake FAQ at:
>         http://www.cmake.org/Wiki/CMake_FAQ
>         
>         Follow this link to subscribe/unsubscribe:
>         http://www.cmake.org/mailman/listinfo/cmake
>         
> 
> 




More information about the CMake mailing list