[CMake] CPack 101

David Cole david.cole at kitware.com
Thu Dec 23 17:05:54 EST 2010


On Thu, Dec 23, 2010 at 3:59 PM, KC Jones <kc.jones at skype.net> wrote:

> > Thanks for your comments and questions. May we quote you on that? ("cmake
> is elegant in the extreme ... great tool")
>
> Of course.  Since all the code I work with is published on multiple OSes,
> cmake is a godsend.  I'm actively working on replacing as much of our legacy
> build methods with cmake solutions.  The cmake basics have come relatively
> easily to me.  CPack is another story.
>
> Once I get through to the end of this tunnel and have learned CPack well
> enough, I hope to be in a position to offer more constructive contributions
> to easing this learning curve.  But, like the problem you describe where
> there is never time for docs and never enough docs, the reality is that when
> my builds are humming, there will be other tasks waiting -- and the task of
> 'giving back to the community' somehow never rises to the top of the stack.
>
> One thought that is jangling around in my head right now:
>
> WRT install(CODE ...) quoting, would it be useful to support the ruby "here
> document" syntax?
>
> install(CODE <<xxx
>    include(BundleUtilities)
>    fixup_bundle("${APPS}" "${QTPLUGINS}" "${DIRS}")
> xxx
>    COMPONENT Runtime)
>
> Or is variable substitution at cmake execution time more the rule than the
> exception?
>
>
I think we've somehow favored install(CODE way too much over install(SCRIPT
in the examples that we *do* have.

If there are serious readability problems with any install(CODE chunk
because of excessive escaping required, it should be in its own file where
it does not need to be escaped, (even if it's only 1, 2 or 3 lines), and
then install(SCRIPT can simply include the file in the very same place where
the CODE would have been generated.

So.... have a file, InstallBundle.cmake whose contents are:

  include(BundleUtilities)
  fixup_bundle("${APPS}" "${QTPLUGINS}" "${DIRS}")

And then use:

  install(SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/InstallBundle.cmake COMPONENT
Runtime)

Much easier on the eyes, much nicer in every respect except there's one
extra file in your source tree now. Small price to pay for readability and
future maintainability...


HTH,
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20101223/52debc58/attachment.htm>


More information about the CMake mailing list