Interprocedural Optimization
Let's learn about optimization in compiler and compiler features in CMake.
We'll cover the following
Usually, compilers optimize the code on the level of a single translation unit, which means that our .cpp
file will be preprocessed, compiled, and then optimized. Later, these files will be passed to the linker to build a single binary. Modern compilers can perform optimization after linking (this is called link time optimization) so that all compilation units can be optimized as a single module. If our compiler supports CMAKE_INTERPROCEDURAL_OPTIMIZATION
. But before we set it, we need to make sure it is supported to avoid errors:
Get hands-on with 1400+ tech skills courses.