[CMake] cpack stripping problem on mac

Clinton Stimpson clinton at elemtech.com
Thu Oct 7 13:30:52 EDT 2010


So I added
SET(CPACK_STRIP_FILES 1)
and on a Mac 10.5, I end up with binaries that don't work.

After looking at the strip(1) man page, I see things like
"% strip -u -r executable 
....is the maximum level of striping for an executable that will still allow 
the program to run correctly with its libraries."

-u and -r are flags to tell strip to keep some symbols it would otherwise 
discard.

"For dynamic shared libraries, the maximum level of stripping is usually -x 
..."
-x is a flag to tell strip to discard some extra symbols.

... and there are a few more examples cases with different flags.

I changed to this in my CMakeCache.txt
CMAKE_STRIP:FILEPATH=/usr/bin/strip -u -r

and now the binaries work correctly.

Instead of me making it work, can this be put into cmake?  (Although, I prefer 
Apple fixed strip so it doesn't behave this way -- but it appears Xcode might 
have these smarts in it).
Doesn't CMake at least know if an executable uses dynamic libraries?

Can cmake add -S as a default flag to strip as well to remove debug symbols?

Thanks,
Clint


More information about the CMake mailing list