I feel like I am missing something basic. I have several CMake targets in my project that depend on a symbolic link set up in the binary folder. It seems I can use either add_custom_target
or add_custom_command
to create the link. However, neither option seems to work very well.
With add_custom_command
, the documentation explicitly warns against using it this way:
Do not list the output in more than one independent target that may build in parallel or the two instances of the rule may conflict (instead use the add_custom_target() command to drive the command and make the other targets depend on that one).
If I use add_custom_target()
for this, the target is considered always out of date and runs every time I press Ctrl-F5 in Visual Studio. This takes enough time to be frustrating.
I just want the link to be created when one of the projects that uses them is first built and not re-created unless deleted.