[cmake-developers] Is it possible to clone an existing target?

Brad King brad.king at kitware.com
Wed Mar 22 08:06:55 EDT 2017

On 03/22/2017 03:30 AM, Stanislav Pankevich wrote:
> I have a target `MyTarget`. Is there a way I could do something like
> clone_target(MyTarget MyNewTarget)
> so that MyNewTarget appears to be the exact clone (deep copy)
> of original target with the only difference of a target name?

There is no builtin way to do that, though you might be able to
get close with a macro that reads target properties from the
original in order to reproduce them with appropriate commands.

What is your use case?


More information about the cmake-developers mailing list