How can you add binary stripping to CMake
for gcc
and clang
as a post-processing step but only in release builds? MSVC
strips by default so it does not have to be handled.
One of the problems is that clang
does not have a -s
compilation flag but gcc
does so doing it this way does not work.
Another idea is to use the strip command. The -s
switch again exists on Linux
but not on XCode
(this is Apple
's development toolchain).
So the final choice is to use the strip
command without any arguments besides the binary itself which appears to be a decent generic solution. How can this be used in CMake
?