[CMake] set “Whole Program Optimization”to Yes in VS 2005

Philip Lowman philip at yhbt.com
Wed Feb 10 02:20:22 EST 2010


On Tue, Feb 9, 2010 at 9:51 PM,  <xiada74 at sina.com> wrote:
> When I use the blow statement for MSVC:
> SET (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /GL")
>
> The corresponding statement in the .vcproj file generated by CMake is:
>
> AdditionalOptions=" /Zm1000 /GL"
>
> When I open the property pages in VS 2005,I can see /GL on the page on
> command line, but the item of“Whole Program Optimization”on the page of
> Optimization is still No.
>
> Why does not CMake generate WholeProgramOptimization="1" in the .vcproj
> file?

Not sure, probably an omission.  "/GL" appears to be supported in
cmVS10CLFlagTable.h but not cmLocalVisualStudio7Generator.

Here's a patch
http://public.kitware.com/Bug/view.php?id=10263

P.S.
If it's not clear, CMake not supporting the WholeProgramOptimization
XML tag only affects what the Visual Studio GUI looks like and doesn't
affect the compiling of the code since the /GL shows up in the
additional options line and thus gets added to the command line when
the compiler is run.

-- 
Philip Lowman


More information about the CMake mailing list