[CMake] CPACK_STRIP_FILES not working for files not built by project

Eric Noulard eric.noulard at gmail.com
Sun Jan 20 06:13:54 EST 2013


2013/1/20 Ian Monroe <ian at monroe.nu>:
> My project is currently producing 100mb RPM/Deb's, but with stripped
> binaries it should clock in at about 20mb.
>
> I have CPACK_STRIP_FILES set to true.
>
> Notably when I do make install/strip that doesn't seem to work either.
> Looking more closely, I see that install/strip does work for the files
> built by the project, but not some of the external libraries I'm
> installing as well (so that they get picked up by CPack.)

This is the expected behavior, CPack does not do the "stripping"
it forwards it to CMake.
The doc says it all:

cpack version 2.8.10.20130117-g2b545
  CPACK_STRIP_FILES
       List of files to be stripped

       Starting with CMake 2.6.0 CPACK_STRIP_FILES will be a boolean variable
       which enables stripping of all files (a list of files evaluates to
       TRUE in CMake, so this change is compatible).

It's a boolean toggle.
Basically CPack forward the stripping to the "install step"
so this is no surprise that you external target/files/libs are not stripped
I guess they should be stripped before being "imported" in your project.

How do you integrate those external files?
As IMPORTED TARGET then INSTALL(TARGETS
or do you
INSTALL(FILES ??
or ??

> Any suggestions? Adding strip manually is doable, just a bit
> troublesome since I can't do cmake configuration time stuff like
> file(glob.

The stripping code should be added to the installation time code
as is it is with CMake handled target.

May be it's doable by creating a CMake script which will do the
extra stripping on the appropriate list of files. Then you'll have to:

insttall(SCRIPT ...)

The appropriate solution heavily depends on how you get external
files installed along with your CMake handled targets.
-- 
Erk
Le gouvernement représentatif n'est pas la démocratie --
http://www.le-message.org


More information about the CMake mailing list