MantisBT - CMake
View Issue Details
0010329CMakeCMakepublic2010-02-24 13:272016-06-10 14:31
Brian Bassett 
Bill Hoffman 
normalmajoralways
closedmoved 
CMake-2-8 
 
0010329: Visual Studio 2008 does not build Fortan objects for mixed-language targets
Given a simple listfile with a target that contains both Fortran and C (or C++) sources:

project(MixedFortran)
cmake_minimum_required(VERSION 2.8)
enable_language(Fortran)
add_executable(MixedFortran main.c fortran.f)

The Visual Studio 2008 generator outputs the following into MixedFortran.vcproj:

            <File
                RelativePath="Z:\src\snext\test\MixedFortran\fortran.f">
            </File>

Visual Studio does not understand how to compile Fortran sources found in a .vcproj. CMake should instead create a MixedFortran.vfproj file containing the Fortran sources. This vfproj should probably be a static library, which should be linked into the MixedFortran target.

This listfile works as expected when using the NMake or Unix makefile generators. Only the Visual Studio generators are affected.
Environment consists of:

CMake 2.8.0
Visual Studio 2008
Intel Visual Fortran 11.1.054

Attached files:

MixedFortran.zip: The source tree
VisualStudio.zip: The out-of-source binary build tree generated with cmake-gui, the "Visual Studio 9 2008" generator, and default compilers. Includes build log for the Debug configuration.
No tags attached.
zip MixedFortran.zip (676) 2010-02-24 13:27
https://public.kitware.com/Bug/file/2898/MixedFortran.zip
zip VisualStudio.zip (413,867) 2010-02-24 21:11
https://public.kitware.com/Bug/file/2900/VisualStudio.zip
patch vs_mixedfortran.v2.patch (17,468) 2010-06-08 22:59
https://public.kitware.com/Bug/file/3176/vs_mixedfortran.v2.patch
Issue History
2010-02-24 13:27Brian BassettNew Issue
2010-02-24 13:27Brian BassettFile Added: MixedFortran.zip
2010-02-24 21:11Brian BassettFile Added: VisualStudio.zip
2010-02-25 09:40Bill HoffmanNote Added: 0019617
2010-02-25 09:40Bill HoffmanStatusnew => assigned
2010-02-25 09:40Bill HoffmanAssigned To => Bill Hoffman
2010-02-25 19:51Brian BassettNote Added: 0019638
2010-06-08 22:59Brian BassettFile Added: vs_mixedfortran.v2.patch
2010-06-08 22:59Brian BassettNote Added: 0020949
2016-06-10 14:27Kitware RobotNote Added: 0041656
2016-06-10 14:27Kitware RobotStatusassigned => resolved
2016-06-10 14:27Kitware RobotResolutionopen => moved
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0019617)
Bill Hoffman   
2010-02-25 09:40   
Yes, this is a limitation of Visual Studio. Do you have a suggestion on how this can work?
(0019638)
Brian Bassett   
2010-02-25 19:51   
I'd probably structure things so that a MixedFortran.vfproj project is created in addition to MixedFortran.vcproj. This new .vfproj would build a static lib of the Fortran sources, which would then be linked with the C/C++ sources in the .vcproj.

I can prototype a patch to CMake or an example of how the project files should look for the MixedFortran example I attached if that would help.
(0020949)
Brian Bassett   
2010-06-08 22:59   
I've attached a prototype patch we're currently using on an internal project that should be able to serve as a starting point for a fix to this issue.
(0041656)
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.