View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0014009CMakeCMakepublic2013-03-13 11:252016-06-10 14:31
ReporterBraden McDaniel 
Assigned ToKitware Robot 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionmoved 
Platformx86OSWindowsOS VersionXP
Product VersionCMake 2.8.10.2 
Target VersionFixed in Version 
Summary0014009: /LTCG option does not cause LinkTimeCodeGeneration to be set in project file
DescriptionAdding the /LTCG linker option to LINK_FLAGS or STATIC_LIBRARY_FLAGS should cause LinkTimeCodeGeneration to be set in the project file. For instance:

  <Tool Name="VCLinkerTool" ... LinkTimeCodeGeneration="1" />

This flag has the following forms that correspond to values 1-4 for the LinkTimeCodeGeneration attribute:

  Option XML Attribute Value
  ---------------------------------------
  /LTCG 1
  /LTCG:PGINSTRUMENT 2
  /LTCG:PGOPTIMIZE 3
  /LTCG:PGUPDATE 4


See: http://msdn.microsoft.com/en-us/library/xbf3tbeh.aspx [^]
Steps To ReproduceAdd /LTCG to the linker (or librarian) using:

  foreach(CONFIG _RELEASE _MINSIZEREL _RELWITHDEBINFO)
    set_property(TARGET foo APPEND PROPERTY LINK_FLAGS${CONFIG} "/LTCG")
  endforeach()


  foreach(CONFIG _RELEASE _MINSIZEREL _RELWITHDEBINFO)
    set_property(TARGET bar APPEND PROPERTY STATIC_LIBRARY_FLAGS${CONFIG} "/LTCG")
  endforeach()

Generate a Visual Studio project file.
Additional InformationI'm observing this on Visual Studio 2008. This bug is similar to bug 0010263; though that bug dealt with the compiler option and this one is about the related linker option.
TagsNo tags attached.
Attached Files

 Relationships
related to 0010263closedDavid Cole /GL flag for Visual Studio 7 does not cause "WholeProgramOptimization" to be set in project file (i.e. GUI) 

  Notes
(0032601)
Brad King (manager)
2013-03-13 11:39

For VS >= 10 we generate the flag mappings from MSBuild rule files, but for VS <= 9 we have to hand-code the table. Try this patch which backports the VS 10 table entries (untested):

diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index dfe8280..1872d60 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -548,6 +548,16 @@ cmVS7FlagTable cmLocalVisualStudio7GeneratorLinkFlagTable[] =
    "Image may be rebased at load-time", "2", 0},
   {"SetChecksum", "RELEASE", "Enable setting checksum in header", "true", 
0},
   {"SupportUnloadOfDelayLoadedDLL", "DELAY:UNLOAD", "", "true", 
0},
+  {"LinkTimeCodeGeneration", "",
+   "Default", "Default", 0},
+  {"LinkTimeCodeGeneration", "LTCG",
+   "Use Link Time Code Generation", "UseLinkTimeCodeGeneration", 0},
+  {"LinkTimeCodeGeneration", "LTCG:PGInstrument",
+   "Profile Guided Optimization - Instrument", "PGInstrument", 0},
+  {"LinkTimeCodeGeneration", "LTCG:PGOptimize",
+   "Profile Guided Optimization - Optimization", "PGOptimization", 0},
+  {"LinkTimeCodeGeneration", "LTCG:PGUpdate",
+   "Profile Guided Optimization - Update", "PGUpdate", 0},
   {"TargetMachine", "MACHINE:I386", "Machine x86", "1", 0},                    
   
{"TargetMachine", "MACHINE:X86", "Machine x86", "1", 0},                     
   
{"TargetMachine", "MACHINE:AM33", "Machine AM33", "2", 0},                   

(0042247)
Kitware Robot (administrator)
2016-06-10 14:28

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.

 Issue History
Date Modified Username Field Change
2013-03-13 11:25 Braden McDaniel New Issue
2013-03-13 11:35 Brad King Relationship added related to 0010263
2013-03-13 11:39 Brad King Note Added: 0032601
2016-06-10 14:28 Kitware Robot Note Added: 0042247
2016-06-10 14:28 Kitware Robot Status new => resolved
2016-06-10 14:28 Kitware Robot Resolution open => moved
2016-06-10 14:28 Kitware Robot Assigned To => Kitware Robot
2016-06-10 14:31 Kitware Robot Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team