[CMake] [CMake ] Specify linker for a mixed language Fortran/C++ application (linux)
Yngve Inntjore Levinsen
yngve.levinsen at gmail.com
Wed Jun 29 04:04:06 EDT 2011
Tirsdag 28 juni 2011 18.52.48 skrev Raphael Muenster :
> Yep, great) setting the LINKER_LANGUAGE to Fortran did it.
>
> Thanks,
> Raphael
>
> Am 28.06.2011 15:48, schrieb Brad King:
> > On 06/27/2011 02:39 PM, Raphael Münster wrote:
> >> # name of the project
> >> PROJECT(Q2P1)
> >>
> >> enable_language (Fortran)
> > Languages can also be specified in the project command:
> >
> > project(Q2P1 C CXX Fortran)
> >
> >> I invoke cmake like this "CC=mpicc CXX=mpic++ cmake -DCMAKE_Fortran_COMPILER=mpif90"
> > FYI, you can use
> >
> > CC=mpicc CXX=mpic++ FC=mpif90 cmake ...
> >
> > and you do not need to set CMAKE_Fortran_COMPILER at all in the cmake code.
> >
> >> So the question is how can I tell cmake to use mpif90 to link the program?
> > Set the LINKER_LANGUAGE target property:
> >
> > http://www.cmake.org/cmake/help/cmake-2-8-docs.html#prop_tgt:LINKER_LANGUAGE
> >
> > with code like
> >
> > set_property(TARGET Q2P1 PROPERTY LINKER_LANGUAGE Fortran)
> >
> > -Brad
> > _______________________________________________
> > 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
>
> _______________________________________________
> 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
>
Just as a side-note, mpif90 is a wrapper compiler for mpi right? Have a look at this thread, which discusses the recommended way to
compile MPI code with cmake:
http://www.cmake.org/pipermail/cmake/2011-June/045032.html
My preferred way is also to specify in the project() command which languages are used. That way if you have a pure fortran project cmake doesn't test your c/c++ compiler etc.
Cheers,
Yngve
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110629/04002b70/attachment.htm>
More information about the CMake
mailing list