符号链接CMake [英] Symbolic links CMake

查看:1122
本文介绍了符号链接CMake的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在 CMakeLists.txt 中重命名某些可执行文件,但也希望从旧名称到新文件的符号链接向后兼容。如何在支持符号链接的系统上实现这一点?

I want to rename certain executables in CMakeLists.txt but also want symbolic links from the older names to new files for backward compatibility. How can this be accomplished on systems that support symbolic links?

同样,不支持符号链接的系统的替代方案是什么?

Also what are the alternatives for system that does not support symbolic links?

感谢

推荐答案

您可以创建自定义目标并使用CMake创建符号链接

You can create a custom target and use CMake to create symlinks

ADD_CUSTOM_TARGET(link_target ALL
                  COMMAND ${CMAKE_COMMAND} -E create_symlink ${target} ${link})

这只适用于支持符号链接的系统,请参阅指南

This will only work on systems that support symlinks, see guide.


仅限UNIX :

Available on UNIX only:

create_symlink旧新 - 创建符号链接new - > old

create_symlink old new - create a symbolic link new -> old

这篇关于符号链接CMake的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆