MantisBT - CMake
View Issue Details
0014777CMakeCMakepublic2014-02-27 05:552014-10-06 10:32
Petr Kmoch 
Brad King 
normalminoralways
closedfixed 
Windows
CMake 2.8.11 
CMake 3.1CMake 3.1 
0014777: OBJECT libraries cause Fortran to relink each time
When using the Visual Studio 10 generator and the solution includes a Fortran executable using objects from a C[XX] OBJECT library, the executable will relink each time 'Build solution' is run (or the executable's project is built).

It ceases to happen when the object files are manually removed from the project as sources and instead added as additional linker dependencies. CMake should probably take this approach when generating a vfproj.

I believe the same was happening for me in VS 2005, but I no longer have that on hand for testing. Neither do I have a chance to test this on newer Visual Studios.

Using "Intel(R) Visual Fortran Compiler XE 13.0.1.119"
Expand the attached testcase and run

> cmake -G "Visual Studio 10"
No tags attached.
zip fortran_object_library.zip (670) 2014-02-27 05:55
https://public.kitware.com/Bug/file/5085/fortran_object_library.zip
Issue History
2014-02-27 05:55Petr KmochNew Issue
2014-02-27 05:55Petr KmochFile Added: fortran_object_library.zip
2014-02-27 09:59Brad KingNote Added: 0035215
2014-02-27 10:06Petr KmochNote Added: 0035216
2014-02-27 10:16Brad KingNote Added: 0035217
2014-02-27 10:16Brad KingAssigned To => Brad King
2014-02-27 10:16Brad KingStatusnew => resolved
2014-02-27 10:16Brad KingResolutionopen => fixed
2014-02-27 10:16Brad KingFixed in Version => CMake 3.1
2014-02-27 10:16Brad KingTarget Version => CMake 3.1
2014-10-06 10:32Robert MaynardNote Added: 0036920
2014-10-06 10:32Robert MaynardStatusresolved => closed

Notes
(0035215)
Brad King   
2014-02-27 09:59   
It looks like we already have the same workaround for a different problem in VS 7.1 and below. We can re-use the code supporting that for this case too:

 VS: For Intel Fortran .vfproj put OBJECT libs in link line
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0f55f254 [^]
(0035216)
Petr Kmoch   
2014-02-27 10:06   
Sounds great, thanks for such a quick solution. I will only be able to test it using 'next' on Monday, but I will definitely do so.
(0035217)
Brad King   
2014-02-27 10:16   
Re 0014777:0035216: Great. Please re-open if you encounter problems with the solution during testing.
(0036920)
Robert Maynard   
2014-10-06 10:32   
Closing resolved issues that have not been updated in more than 4 months.