[CMake] Fortan and C++

Michael Wild themiwi at gmail.com
Fri Aug 21 14:15:05 EDT 2009





On 21.08.2009, at 17:57, Dominik Szczerba <dominik at itis.ethz.ch> wrote:

> I want to compile one file with fortran compiler (intel) and link  
> with the rest of my project. Will the latest cmake allow to fully  
> cmakify such scenario?

Hi Dominik

If I remember correctly, you'll have to set the LINK_LANGUAGE property  
of your target to Fortran and then ensure that the Fortran linker also  
links against the C++ standard library. For Intel this would be -stdc+ 
+ (or some such). If you are creating an executable, depending on  
where your main-function is defined, you might also need to tell the  
linker to not add a Fortran main-function, the flag is called - 
nofor_main if I remember correctly. Otherwise the ifort man-page will  
tell you :)


HTH

Michael 
  


More information about the CMake mailing list