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

David Cole DLRdave at aol.com
Sun Feb 15 12:16:15 EST 2015


The easiest thing is probably to use the install(SCRIPT or
install(CODE signature of the install command rather than having a
"build time" custom command.


HTH,
David C.


On Sun, Feb 15, 2015 at 9:55 AM, Paul Smith <paul at mad-scientist.net> wrote:
> In my Mac OSX builds I want to run dsymutil to create .dSYM debug contents.
> However, this is very slow so I don't want to do it during normal builds
> (where it's not needed because I have all the object files), I only want it
> to be done during the install step.
>
> I can create an add_custom_command() to run dsymutil easily enough,
> something like:
>
>   function(stagedebug target dir)
>       if(APPLE)
>           set(destfile "${dir}/${target}.dSYM/Contents/Info.plist")
>           add_custom_command(OUTPUT "$destfile"
>               COMMAND dsymutil "${dir}/${target}"
>               MAIN_DEPENDENCY ${target}
>               COMMENT "Staging dSYM for ${target} to ${dir}"
>               VERBATIM)
>
>           # Now what?
>       endif
>   endfunction()
>
>
> but I have no idea how to hook this into the install step.  I don't see
> anything in the install() command that lets me specify a target to be run,
> it just seems to be able to copy files.
>
> What am I missing?
>
> Thanks!
>
> --
>
> 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