[CMake] avoid permanent rebuild of custom_target

Stuermer, Michael SP/HZA-ZSEP michael.stuermer at schaeffler.com
Wed Nov 25 07:30:40 EST 2015


How can I avoid a custom target to be rebuild everytime I build my solution? I added my target like this:

add_custom_target(CopyNugetPackages
    DEPENDS ${depends_list}
    COMMENT "======== copying nuget packages ========"
    VERBATIM
    )
set_target_properties(CopyNugetPackages PROPERTIES
    EXCLUDE_FROM_ALL TRUE
    FOLDER "CMakePredefinedTargets")

The variable "depends_list" contains a list of custom_command outputs (essentially .dll files which are copied). All the custom commands are actually only executed once, but the custom target "CopyNugetPackages" is run over and over again.

I would like to run "CopyNugetPackages" only as a dependency from other targets:

add_dependencies(${target} CopyNugetPackages)

So "CopyNugetPackages" should only be built if ${target} is built. How can I do this or is it impossible?


Best Regards

Michael Stürmer
SP/HZA-ZSEP
Postcode HZA 13-4-06
SZ.Prozessdatenverarbeitung

Schaeffler Technologies AG & Co. KG
Industriestraße 1-3
91074 Herzogenaurach (Germany)
Tel. +49  91 32 / 82 - 86350  ·  Fax +49 91 32 / 82 - 45 86350
Mobil.: +49 171 6860010
mailto:michael.stuermer at schaeffler.com<mailto:stefan.soutschek at schaeffler.com>  ·  http://www.ina.de<http://www.ina.de/>

Registered Seat: Herzogenaurach
Commercial Register: AG Fürth HRA 9349

General Partner: INA Beteiligungsgesellschaft mit beschränkter Haftung Registered Seat: Herzogenaurach (Germany)
Commercial Register: AG Fürth HRB 2379

Managing Directors:
Klaus Rosenfeld (CEO), Prof. Dr. Peter Gutzmer, Norbert Indlekofer, Oliver Jung, Kurt Mirlach, Prof. Dr. Peter Pleus, Robert Schullan

This e-mail message is intended only for the use of the named recipient-(s) and contains information which may be confidential or privileged. If you are not the intended recipient, be aware that any distribution, or use of the contents of this information is prohibited. If you have received this electronic transmission in error, please notify the sender and delete the material from the computer.





-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20151125/d08340df/attachment.html>


More information about the CMake mailing list