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

Reply via email to