[CMake] Windows Whole Program Optimization options

J Decker d3ck0r at gmail.com
Thu Feb 11 22:02:00 EST 2016


By default Cmake generates project files with no
<WholeProgramOptimization> set in uhmm...these sections...

  <PropertyGroup
Condition="'$(Configuration)|$(Platform)'=='MinSizeRel|Win32'"
Label="Configuration">
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <UseOfMfc>false</UseOfMfc>
    <CharacterSet>MultiByte</CharacterSet>
    <PlatformToolset>v140</PlatformToolset>
  </PropertyGroup>


Default for VS14 is - when creating a new project includes
    <WholeProgramOptimization>true</WholeProgramOptimization>



nothing defaults to 'No Whole Program Optimization'
    <WholeProgramOptimization>true equates to 'Use Link Time Code Generation'

There's also guided profile optimization options... but probably less
important for automated builds like cmake produces.

I bring this up because in release mode, with No Whole Program
Optimization there's a bug in the compiler that optimizes away certain
code.  This makes several of my projects fail.  In late december they
confirmed it, but have as of yet not seen any updates to fix said
issue.  Plus, having the optimization option able to be set would be a
bonus anyway since it makes programs smaller.  (Yes, it's kind of
silly that not having optimization doesn't work, one would think that
the optimize option would remove it)

Any thoughts on how this might be specified in cmake?


More information about the CMake mailing list