# How to properly strip release binaries

**URL:** <https://discourse.cmake.org/t/how-to-properly-strip-release-binaries/3521>\
**Category:** Code\
**Created:** [June 7, 2021, 4:07pm UTC](https://discourse.cmake.org/t/how-to-properly-strip-release-binaries/3521 "2021-06-07T16:07:19Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![eri0](https://discourse.cmake.org/user_avatar/discourse.cmake.org/eri0/32/733_2.png) [@eri0](https://discourse.cmake.org/u/eri0)\
**Post date:** [June 7, 2021, 4:07pm UTC](https://discourse.cmake.org/t/how-to-properly-strip-release-binaries/3521/1 "2021-06-07T16:07:19Z")

</div>

Hi,

I would like that my application binaries were stripped in the release builds. My application currently builds for Linux, Windows, MacOS and Android. What’s the proper CMake way of doing this?

---

<div class="post-metadata">

**Author:** ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)\
**Post date:** [June 7, 2021, 4:31pm UTC](https://discourse.cmake.org/t/how-to-properly-strip-release-binaries/3521/2 "2021-06-07T16:31:43Z")

</div>

The Unix Makefiles and Ninja generators provide `install/strip` targets to do this. I don’t think there’s a general mechanism though.

---

<div class="post-metadata">

**Author:** ![eri0](https://discourse.cmake.org/user_avatar/discourse.cmake.org/eri0/32/733_2.png) [@eri0](https://discourse.cmake.org/u/eri0)\
**Post date:** [June 8, 2021, 2:51pm UTC](https://discourse.cmake.org/t/how-to-properly-strip-release-binaries/3521/3 "2021-06-08T14:51:02Z")

</div>

But is it possible to do it without installing?

The only way I found so far was kinda specific to gcc I think. I wanted some way that simply was set and forget for everything possible.

---

<div class="post-metadata">

**Author:** ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)\
**Post date:** [June 8, 2021, 3:56pm UTC](https://discourse.cmake.org/t/how-to-properly-strip-release-binaries/3521/4 "2021-06-08T15:56:45Z")

</div>

No, CMake provides no “strip binaries” abstraction other than through the install on those generators. The closest you can get is to use the Release build otherwise.

---

<div class="post-metadata">

**Author:** ![YMba9g8j9CJp0wLoQf5y](https://discourse.cmake.org/user_avatar/discourse.cmake.org/ymba9g8j9cjp0wloqf5y/32/1244_2.png) [@YMba9g8j9CJp0wLoQf5y](https://discourse.cmake.org/u/YMba9g8j9CJp0wLoQf5y)\
**Post date:** [June 8, 2021, 7:53pm UTC](https://discourse.cmake.org/t/how-to-properly-strip-release-binaries/3521/5 "2021-06-08T19:53:53Z")

</div>

What does “stripping binaries” even mean?

---

<div class="post-metadata">

**Author:** ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)\
**Post date:** [June 8, 2021, 8:02pm UTC](https://discourse.cmake.org/t/how-to-properly-strip-release-binaries/3521/6 "2021-06-08T20:02:29Z")

</div>

It is usually a process which removes debug info and symbols from binaries to make them smaller. Other details may also be tweaked, but it’s largely a “cleanse debugging info” process.
