CMake 3.13 Interprocedural Optimization for Visual C++: Whole Program Optimization (LTCG)

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

CMake 3.13 Interprocedural Optimization for Visual C++: Whole Program Optimization (LTCG)

Niels Dekker
I'm very pleased that CMake 3.13 (just released) includes the "IPO for
VS" feature that I implemented, with help from Brad Kind: it allows
enabling Whole Program Optimization (Link Time Code Generation) on a
Visual C++ project, by means of CMake flag INTERPROCEDURAL_OPTIMIZATION.

Visual Studio offers this option (LTCG) for more than a decade already,
within the IDE. I'm glad that it's now also directly available to
VS/CMake users.

In general, I would suggest to enable this option only for a Release
build. As follows:

   project(MyProject)
   add_executable(MyProject MyMain.cpp MySource.cpp)
   set_property(TARGET MyProject PROPERTY
INTERPROCEDURAL_OPTIMIZATION_RELEASE TRUE)

I'm interested to hear from other VS/CMake users if they find this new
option helpful. And specifically whether they experience a significant
performance gain from their application, after enabling IPO.

Note that my request to enable IPO "by default" for Release
configurations has been rejected, at least for the time being:
https://gitlab.kitware.com/cmake/cmake/issues/17720  So for now, users
have to explicitly switch on this option.


Kind regards, Niels
--
Niels Dekker
Scientific programmer
LKEB, Leiden University Medical Center
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake