[CMake] symlinks during install

Scott Carver f.scott.carver at gmail.com
Sun May 31 17:53:37 EDT 2015


I have a cmake setup that uses symlinks to place resource
files/directories/libraries relative to several different subcomponents
during the build process. This avoids excessive copying, and makes it
easier to build / test individual components. Something like this (*'s as
symlinks):
   /build/componentA/
         /componentA.app
         /HelpFiles*
   /build/componentB/
        /HelpFiles*
        /componentB.app
                /Contents/Resources/componentA.app*

During the install stage, I'm assembling all of the subcomponents into an
.app package (on mac, at least), and obviously need the symlinks to be
turned into copies. This is proving to be tricky.... The symlinks are
copied over to the install folder as I install each component, so later
steps to install hard-copies of those files fails, as they collide with
existing symlinks. Explicitly deleting those symlinks in the install folder
doesn't seem like an option - the locations/names come from generator
expressions, which can't easily be expanded in a post-install "install(CODE
...)" command, for example.

It's not difficult to simple provide a fixed list of symlinks to replace
with copies, glob-and-replace ALL symlinks with copies, or just do the
symlink swap with a shell script - but none of those feel like good
solutions. I don't want to resolve symlinks that shouldn't be resolved, and
I don't want to maintain a global list of symlinks to resolve (that has to
be updated if a component is added or moved).

Any advice on how to do this in a proper CMAKE way? Or - any strategies I
can use to avoid some of the excess copying?

Thanks much
Scott C
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20150531/061f3d8d/attachment.html>


More information about the CMake mailing list