如何在CMake中重命名库文件名? [英] How do you rename a library filename in CMake?
本文介绍了如何在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屋!
查看全文