如何在 CMake 中重命名库文件名? [英] How do you rename a library filename in CMake?

查看:37
本文介绍了如何在 CMake 中重命名库文件名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

某些库的文件名遵循不同的约定,例如 PAM 库 -- pam_unix.so,而不是 libpam_unix.so.

Some libraries follow different conventions for their filenames, such as the PAM libs -- pam_unix.so, not libpam_unix.so.

如何在 CMake 中覆盖目标库文件名以获得类似 new_thing.so 的内容而不是默认的 libnew_thing.so?

How do you override the target library filename in CMake to get something like new_thing.so instead of the default libnew_thing.so?

推荐答案

您可以使用 set_target_properties() 函数和 PREFIX 更改前缀、输出名称和后缀/OUTPUT_NAME/SUFFIX 属性如下:

You can change the Prefix, Output Name and Suffix using the set_target_properties() function and the PREFIX / OUTPUT_NAME / SUFFIX property in the following way:

前缀:

    set_target_properties(new_thing PROPERTIES PREFIX "")

输出名称:

    set_target_properties(new_thing PROPERTIES OUTPUT_NAME "better_name")

后缀:

    set_target_properties(new_thing PROPERTIES SUFFIX ".so.1")

这篇关于如何在 CMake 中重命名库文件名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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