<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman",serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
{mso-style-name:msonormal;
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:12.0pt;
font-family:"Times New Roman",serif;}
span.EmailStyle18
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="DE" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US">This would be a great feature! Currently I override my release flags by setting CMAKE_<LANG>_FLAGS_RELEASE_INIT and CMAKE_<TYPE>_LINKER_FLAGS_RELEASE_INIT
in a CMAKE_USER_MAKE_RULES_OVERRIDE script. Direct support for /GL and /LTCG in CMake would be great. Fewer target specifics to worry about…<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">Fraunhofer-Institut für Graphische Datenverarbeitung IGD<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">Fraunhoferstr. 5 | 64283 Darmstadt | Germany<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">Tel +49 6151 155-606 | Fax +49 6151 155-139<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><a href="mailto:johannes.mueller-roemer@igd.fraunhofer.de">johannes.mueller-roemer@igd.fraunhofer.de</a> |
<a href="http://www.igd.fraunhofer.de">www.igd.fraunhofer.de</a><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif"> CMake [mailto:cmake-bounces@cmake.org]
<b>On Behalf Of </b>Cristian Adam<br>
<b>Sent:</b> Wednesday, January 24, 2018 21:42<br>
<b>To:</b> Niels Dekker <niels_dekker_address_until_2024@xs4all.nl><br>
<b>Cc:</b> cmake <cmake@cmake.org><br>
<b>Subject:</b> Re: [CMake] Link Time Code Generation (LTGC) by default, for Release configurations of Visual Studio projects?<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">Hi,<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">I had a quick check to see if CMake 3.10 for which compilers it has support for
<a href="https://cmake.org/cmake/help/v3.10/prop_tgt/INTERPROCEDURAL_OPTIMIZATION.html#prop_tgt:INTERPROCEDURAL_OPTIMIZATION">
Interprocedural Optimization</a> (IPO, or LTCG as known on Visual C++).<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Modules/Compiler had only for <b>GNU</b>, <b>Clang</b> and <b>
PGI</b> the following:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Courier New"">set(_CMAKE_${lang}_IPO_MAY_BE_SUPPORTED_BY_COMPILER YES)</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">QNX with QCC didn't have it set to YES even though nowdays QNX comes with GCC 5.4.0 on QNX 7.0, which should be just fine.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">It would be nice if CMake would have support for IPO on Visual C++.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">The steps would be to set the right variables into Modules/Compiler/MSVC-CXX.cmake, change the
<a href="https://cmake.org/cmake/help/v3.10/module/CheckIPOSupported.html?#module:CheckIPOSupported">
CheckIPOSupported</a> module, change some flags in some places,update tests, documentation, and so on.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Shouldn't be hard to add this feature.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Cheers,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Cristian.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">On Wed, Jan 24, 2018 at 9:06 PM, Niels Dekker <<a href="mailto:niels_dekker_address_until_2024@xs4all.nl" target="_blank">niels_dekker_address_until_2024@xs4all.nl</a>> wrote:<o:p></o:p></p>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm">
<p class="MsoNormal">When a Visual C++ project is created within Visual Studio (by File menu, New, Project...), it has Link Time Code Generation (LTGC) by default, for its Release configurations: Compiler option /GL and linker option /LTCG. However, when the
Visual C++ project is generated by CMake, it does not have LTGC, by default. LTCG looks like a very useful feature to me. I think it's worth enabling the feature by default, for Release configurations. What do you think?<br>
<br>
<br>
Some details:<br>
<br>
I created a "dummy" Visual C++ project in Visual Studio 2017 (Version 15.5.4), by File menu, New, Project..., and I also generated one by CMake (version 3.10.2), using a very minimal CMakeLists.txt<br>
<br>
The Visual C++ project created by Visual Studio 2017 has the following compile options, by default, for Release (x64):<br>
<br>
/permissive- /GS /GL /W3 /Gy /Zc:wchar_t /Zi /Gm- /O2 /sdl /Fd"x64\Release\vc141.pdb" /Zc:inline /fp:precise /D "_MBCS" /errorReport:prompt /WX- /Zc:forScope /Gd /Oi /MD /Fa"x64\Release\" /EHsc /nologo /Fo"x64\Release\" /Fp"x64\Release\MyVS2015Project.pch"
/diagnostics:classic<br>
<br>
And the following linker options:<br>
<br>
/OUT:"F:\X\Src\MyProject\MyVS2015Project\x64\Release\MyVS2015Project.exe" /MANIFEST /LTCG:incremental /NXCOMPAT /PDB:"F:\X\Src\MyProject\MyVS2015Project\x64\Release\MyVS2015Project.pdb" /DYNAMICBASE "kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "comdlg32.lib"
"advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "odbc32.lib" "odbccp32.lib" /DEBUG:FULL /MACHINE:X64 /OPT:REF /PGD:"F:\X\Src\MyProject\MyVS2015Project\x64\Release\MyVS2015Project.pgd" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /ManifestFile:"x64\Release\MyVS2015Project.exe.intermediate.manifest"
/OPT:ICF /ERRORREPORT:PROMPT /NOLOGO /TLBID:1<br>
<br>
The vcxproj file created by Visual Studio has "<WholeProgramOptimization>true</WholeProgramOptimization>" for its Release configurations.<br>
<br>
<br>
The Visual C++ project generated by CMake (Generator: Visual Studio 15 2017 Win64) has the following compile options, for its Release configuration:<br>
<br>
/GS /TP /W3 /Zc:wchar_t /Gm- /O2 /Ob2 /Fd"MyExecutable.dir\Release\vc141.pdb" /Zc:inline /fp:precise /D "WIN32" /D "_WINDOWS" /D "NDEBUG" /D "CMAKE_INTDIR=\"Release\"" /D "_MBCS" /errorReport:prompt /WX- /Zc:forScope /GR /Gd /MD /Fa"Release/" /EHsc /nologo
/Fo"MyExecutable.dir\Release\" /Fp"MyExecutable.dir\Release\MyExecutable.pch" /diagnostics:classic<br>
<br>
And the following linker options:<br>
<br>
/OUT:"F:\X\Bin\vc141-64\MyProject\Release\MyExecutable.exe" /MANIFEST /NXCOMPAT /PDB:"F:/X/Bin/vc141-64/MyProject/Release/MyExecutable.pdb" /DYNAMICBASE "kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib"
"comdlg32.lib" "advapi32.lib" /IMPLIB:"F:/X/Bin/vc141-64/MyProject/Release/MyExecutable.lib" /MACHINE:X64 /INCREMENTAL:NO /PGD:"F:\X\Bin\vc141-64\MyProject\Release\MyExecutable.pgd" /SUBSYSTEM:CONSOLE /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /ManifestFile:"MyExecutable.dir\Release\<a href="http://MyExecutable.exe.int">MyExecutable.exe.int</a>ermediate.manifest"
/ERRORREPORT:PROMPT /NOLOGO /TLBID:1<br>
<br>
The vcxproj file generated by CMake does not have a "<WholeProgramOptimization>" tag.<br>
<br>
<br>
I hope you can consider adding LTCG to Release configurations of Visual C++ projects generated by CMake, by default.<br>
<br>
<br>
Kind regards, Niels<br>
-- <br>
Niels Dekker<br>
Scientific programmer<br>
LKEB, Leiden University Medical Center<br>
-- <br>
<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">
http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
<br>
CMake Support: <a href="http://cmake.org/cmake/help/support.html" target="_blank">
http://cmake.org/cmake/help/support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" target="_blank">
http://cmake.org/cmake/help/consulting.html</a><br>
CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" target="_blank">
http://cmake.org/cmake/help/training.html</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">
http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="https://cmake.org/mailman/listinfo/cmake" target="_blank">https://cmake.org/mailman/listinfo/cmake</a><o:p></o:p></p>
</blockquote>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</body>
</html>