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

Iosif Neitzke iosif.neitzke+cmake at gmail.com
Sun Feb 15 19:26:10 EST 2015


For conditional file install, you could try something like "cmake -E
copy_if_different".

On Sun, Feb 15, 2015 at 1:59 PM, Paul Smith <paul at mad-scientist.net> wrote:
> On Sun, 2015-02-15 at 12:16 -0500, David Cole wrote:
>> 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.
>
> Hm.  That has the disadvantage that it runs every time, even if the
> binary hasn't been modified, but it does work:
>
>   install(CODE "message(STATUS \"Creating dSYM for ${target} in ${dir}\")")
>   install(CODE "execute_process(COMMAND dsymutil \"${dir}/${target}\" OUTPUT_QUIET)")
>
> It's too bad that execute_process() doesn't have a COMMENT field, but
> this works OK.  It wasn't clear to me how to pass arguments to a SCRIPT
> so I used CODE instead.
>
> It'd be nice if I could make it a real target that only is invoked on
> install, so that we'd not re-run the command if it wasn't necessary, but
> this gets the work done; thanks for the pointer!
>
> --
>
> 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