How to properly install a symbolic link for backwards compatibility?

We are having a bit of an issue where we are trying to change the name of an executable. But trying to preserve backwards compatibility by providing a symbolic link. To not break downstream users.

I’m unsure how to write robust CMake code for this scenario.

install(TARGETS NewName)

... # Install symlink with old name

I would make a symlink as part of the build with add_custom_command, use install(FILES), and add a deprecated IMPORTED executable target in your config files to represent it.

1 Like