MantisBT - CMake
View Issue Details
0007389CMakeCMakepublic2008-07-22 10:162016-06-10 14:30
Federico Carminati 
Bill Hoffman 
normalmajoralways
closedmoved 
CMake-2-6 
 
0007389: Fortran flags assigned to C compiler when generating Xcode
Currently CMake does not support Fortran language for Xcode, as Xcode itself does not support it. However it is possible to generate an Xcode project where C files are compiled but not Fortran files. In this case CMake assigns to the C compiler the flags defined for the fortran compiler, and therefore also C compilation breaks. This should not happen. Please consider the following example of CMakeLists.txt

Project(Test)
Cmake_Minimum_Required(VERSION 2.6)
Set(CMAKE_Fortran_COMPILER gfortran)
Enable_Language(Fortran)
Set(CMAKE_Fortran_FLAGS "-fno-second-underscore")
Add_Executable(hello hello.c sub.F)

Xcode generation works, however the -fno-second-underscore flag ends up in the CFLAGS and therefore C compilation fails.
The files mentioned before are immaterial, however for completeness here they are

[.../Users/fca/cmaketest] cat sub.f
      subroutine sub
      print *, 'Hello World from Fortran!'
      end

[.../Users/fca/cmaketest] cat hello.c
#include <stdio.h>

void sub_();
int main () {printf(" Hello World from C!\n"); sub_(); return 0;}

No tags attached.
Issue History
2008-07-22 10:16Federico CarminatiNew Issue
2008-08-19 16:47Bill HoffmanStatusnew => assigned
2008-08-19 16:47Bill HoffmanAssigned To => Bill Hoffman
2016-06-10 14:27Kitware RobotNote Added: 0041442
2016-06-10 14:27Kitware RobotStatusassigned => resolved
2016-06-10 14:27Kitware RobotResolutionopen => moved
2016-06-10 14:30Kitware RobotStatusresolved => closed

Notes
(0041442)
Kitware Robot   
2016-06-10 14:27   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.