[CMake] How to build a target on install (only)?

David Cole DLRdave at aol.com
Mon Feb 16 09:46:20 EST 2015


The other way you could approach this, but which would not be as
simple would be to invent *your own* custom install target
(install_with_dSYM, or whatever name makes sense to you). Then you
could have that target depend on all the custom targets that build the
dSYM files. When you build this custom install_with_DSYM target, it
would first build all the dSYM files via add_custom_command rules, and
*then* run the same command that "make install" runs to install all
the other files. Or vice versa, if the dSYM needs to be run on stuff
in the install tree...

HTH,
D


On Mon, Feb 16, 2015 at 9:25 AM, Paul Smith <paul at mad-scientist.net> wrote:
> On Sun, 2015-02-15 at 18:26 -0600, Iosif Neitzke wrote:
>> For conditional file install, you could try something like "cmake -E
>> copy_if_different".
>
> That won't work; I don't have any files to copy.  What I want is to run
> the dsymutil command during install only, not during the normal build
> (because it's slow), but only if the binary that was installed has
> changed.
>
> copy_if_different won't help here.
>
>> On Sun, Feb 15, 2015 at 1:59 PM, Paul Smith <paul at mad-scientist.net> wrote:
>> >   install(CODE "message(STATUS \"Creating dSYM for ${target} in ${dir}\")")
>> >   install(CODE "execute_process(COMMAND dsymutil \"${dir}/${target}\" OUTPUT_QUIET)")
>
>
>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake


More information about the CMake mailing list