Home

MinSizeRel

MinSizeRel stands for minimum size release and is one of the standard build configurations provided by CMake. It designates a release-style build that prioritizes small binary size over execution speed. This configuration is commonly used when minimizing the footprint of a produced artifact is more important than raw performance, such as in embedded deployment or distribution packaging.

When you configure a project with CMake, you select MinSizeRel as the build type by setting CMAKE_BUILD_TYPE

MinSizeRel is distinct from Release, which emphasizes performance, and RelWithDebInfo, which balances speed with debugging information.

Users can further customize the flags for this configuration by setting the language-specific variables CMAKE_C_FLAGS_MINSIZEREL and

to
MinSizeRel
(for
single-configuration
generators)
or
by
choosing
the
corresponding
configuration
in
a
multi-config
generator
such
as
Visual
Studio.
The
exact
compiler
and
linker
flags
used
for
MinSizeRel
are
supplied
by
the
toolchain,
but
they
generally
enable
size-focused
optimizations
(for
example,
-Os
or
-Oz
on
GCC/Clang
and
/O1
on
MSVC)
and
minimize
or
omit
debug
information
relative
to
other
release
modes.
Compared
with
Debug,
MinSizeRel
typically
uses
optimizations
with
a
clear
focus
on
shrinking
code
size,
at
the
potential
cost
of
some
transparency
during
debugging.
CMAKE_CXX_FLAGS_MINSIZEREL
(and
their
linker
counterparts)
if
the
default
settings
do
not
meet
their
needs.