[CMake] CPACK_STRIP_FILES not working for files not built by project
Ian Monroe
ian at monroe.nu
Sun Jan 20 13:47:57 EST 2013
On Sun, Jan 20, 2013 at 3:13 AM, Eric Noulard <eric.noulard at gmail.com> wrote:
> 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.
Well I have another step where I extract the debug symbols. :) And I
just want to coordinate all this in one place (eg my cmake files).
> How do you integrate those external files?
> As IMPORTED TARGET then INSTALL(TARGETS
> or do you
> INSTALL(FILES ??
> or ??
Just a plain INSTALL(FILES...)
>> 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.
Yea I guess I could do install(CODE...) and then a file(GLOB...) would
actually work.
Ian
More information about the CMake
mailing list