Share target between multiple configs

If you have a project with multiple configurations (e.g. Debug and Release), is there a way for a target to be shared between multiple configurations so that it is only build once?

If you have a add_custom_target that just runs some script, the output might not depend on what configuration you’re running. For the sake of saving disk space and build time, it would be nice if the different configurations could share the same output.

In many cases these custom targets will be small enough that you can live with building them twice, but at my ${DAYJOB} we have a script that is rather slow and has a lot of output. Right now we don’t call it from cmake at all, but it would be nice to be able to integrate it with cmake.