Protect some custom targets created inside of macros
Summary
If a (custom) targets is created inside a macro or function and this macros is called multiple times, the same target would be created multiple times as well. This leads to cmake errors. A simple protection by checking whether this target already exists prevents from such errors.