I posted an issue on the mantis bug tracker a while ago regarding supporting 
the /LTCG option for the MSVC71 generator.  The issue history indicates this 
problem is fixed, but with CMake 2.6.2 the correct flags are still not being 
generated for the MSVC71 project files and nmake makefiles.  Fortunately, the 
MSVC compiler/linker is smart enough to realize this and restarts the link 
using /LTCG.  The only bad thing about this is it extends the time required to 
link because it has to restart the link again.

Some details are provided below.  Thanks in advance!
Luke

-----------------------
NMake output:
-----------------------
Linking CXX static library ..\build\MT-DLL\Util-SL.lib
XMLWriter.cpp.obj : warning LNK4218: non-native module found; restarting link 
with /LTCG

-----------------------
MSVC71 output:
-----------------------
Timer.obj : warning LNK4218: non-native module found; restarting link with /LTCG

-----------------------------
Here's the original issue:
-----------------------------

Summary 0006794: Visual Studio compiler 'WholeProgramOptimization' (/LTCG) 

Description 

Hi,

The cl.exe compiler option /LTCG (i.e. "WholeProgramOptimization") does not 
seem to be generated correctly into the Visual Studio project file. This error 
occurs in Visual Studio .NET 2003 (v7.1), and probably occurs in later versions 
as well.

The /LTCG is a whole configuration setting, which should be added to the 
"Configuration" xml tag in the vcproj file as in the following example:

  <Configuration
    Name="Release|Win32"
    OutputDirectory="Release"
    . . .
    WholeProgramOptimization="TRUE">

This should be an easy fix. Please feel free to contact me with any questions 
you may have.

Thanks!
Luke

(0013076)
bill.hoffman (manager) 
2008-08-19 15:09
Committer: Bill Hoffman <[EMAIL PROTECTED]>
/cvsroot/CMake/CMake/Source/cmGlobalVisualStudio7Generator.cxx,v <-- 
cmGlobalVisualStudio7Generator.cxx
new revision: 1.101; previous revision: 1.100

BTW, this flag is not supported in VS8 and greater:
cl : Command line warning D9002 : ignoring unknown option '/LTGC'

Issue History 
Date Modified Username Field Change 
2008-04-11 15:49 lkucalaba New Issue 
2008-08-19 15:09 bill.hoffman Status new => closed 
2008-08-19 15:09 bill.hoffman Note Added: 0013076 
2008-08-19 15:09 bill.hoffman Resolution open => fixed

_______________________________________________
CMake mailing list
[email protected]
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to