[CMake] FindMPI and setting C/C++ compiler
Michael Wild
themiwi at gmail.com
Wed May 26 14:10:29 EDT 2010
Well, the MPI_COMPILER variable is certainly used internally by FindMPI to detect all the stuff. And to use MPI_LINK_FLAGS, just set them as the target property LINK_FLAGS.
Michael
On 26. May, 2010, at 18:15 , Marcel Loose wrote:
> True, but that raises (at least) two questions:
>
> 1) What's the use of the variable MPI_COMPILER if it cannot be used to
> set the C/C++ compiler.
>
> 2) I know how to handle MPI_COMPILE_FLAGS - use add_definitions();
> MPI_INCLUDE_PATH - use include_directories(); MPI_LIBRARIES - use
> target_link_libraries(). But how do I handle MPI_LINK_FLAGS?
>
> Regards,
> Marcel Loose.
>
> On Wed, 2010-05-26 at 17:38 +0200, Michael Wild 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
>
>
More information about the CMake
mailing list