[CMake] Cmake: VS2013: General -> Whole Program Optimization (/LTCG)

Paul Annetts paul at lightunobscured.com
Fri May 8 15:51:21 EDT 2015


It's a linker flag, so for a target of "MyTarget" use:

 

set_target_properties(MyTarget PROPERTIES LINK_FLAGS "/LTCG")

 

(I had to do this for this exact flag, so I know this should work)

 

Hope that helps,

 

Paul.

 

From: CMake [mailto:cmake-bounces at cmake.org] On Behalf Of Sachin Gaikwad
Sent: 08 May 2015 13:55
To: cmake at cmake.org
Subject: [CMake] Cmake: VS2013: General -> Whole Program Optimization
(/LTCG)

 

Hi all,

 

I am using: 

 - cmake-3.0.2

 - Visual Studio 2013 (Update 4)

 

I get this log message in build logs when I build any target in my Visual
Studio solution:

 

"MSIL .netmodule or module compiled with /GL found; restarting link with
/LTCG; add /LTCG to the link command line to improve linker performance"

 

I read online on this and found this Microsoft link
(https://msdn.microsoft.com/en-us/library/xbf3tbeh.aspx) which suggests that
I should set "Whole Program Optimization" under "General" properties to "Use
Link Time Code Generation" (/LTCG).

 

I am not able to figure out which cmake variables I should set this in? I
tried setting this flag in following variables, but it did not work.

 

CMAKE_EXE_LINKER_FLAGS

CMAKE_MODULE_LINKER_FLAGS

CMAKE_SHARED_LINKER_FLAGS

 

Thanks,

Sachin

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20150508/a146c0a9/attachment.html>


More information about the CMake mailing list