Link Time Code Generation (LTCG) by default, for Release configurations of Visual Studio projects
It would be great to have enabled Link Time Code Generation (LTCG) by default, for Release configurations of Visual Studio projects, generated by CMake.
Unfortunately, currently, with CMake <= 3.10.2, LTCG is disabled by default for any configuration of a CMake generated Visual C++ project. On the contrary, when a Visual C++ project is created within Visual Studio (by File menu, New, Project...), it has Link Time Code Generation (LTCG) by default, for its Release configurations: Compiler option /GL and linker option /LTCG. I checked Visual Studio 2008, Visual Studio 2010, Visual Studio 2013, Visual Studio 2015 and Visual Studio 2017. VCXPROJ files created by Visual Studio (>= 2010) have <WholeProgramOptimization>true</WholeProgramOptimization> for their Release configurations.
[For the record: VCPROJ files created by Visual Studio 2008 do not have this <WholeProgramOptimization> tag, but instead, they have LTCG enabled for their Release configuration by an XML attribute, WholeProgramOptimization="1", of the XML tag named Configuration.]
This issue was discussed from January 24, 2018, from https://public.kitware.com/pipermail/cmake/2018-January/066970.html with encouraging replies from Cristian Adam and Johannes Sebastian Mueller-Roemer.