当 TEMPLATE=lib 时,如何强制 qmake 不创建指向目标的符号链接?

发布于 2024-07-26 12:59:49 字数 508 浏览 3 评论 0原文

我有一个(部分)qmake 项目文件,如下所示:

TEMPLATE=lib
TARGET=whatever
SOURCES=whatever.cpp
HEADERS=whatever.h

这将 - 至少默认情况下 - 创建一个库和一些符号链接,如下所示:

libwhatever.so -> libwhatever.so.0.1.0
libwhatever.so.0 -> libwhatever.so.0.1.0
libwhatever.so.0.1 -> libwhatever.so.0.1.0
libwhatever.so.0.1.0

libwhatever.so.0.1.0 是实际的库二进制文件,其余的只是符号链接。

我想要实现的是,根本不创建任何符号链接,或者以其他方式创建符号链接,以便 libwhatever.so 将是实际的二进制文件,其余的是符号链接。

I have a (partial) qmake project file like this:

TEMPLATE=lib
TARGET=whatever
SOURCES=whatever.cpp
HEADERS=whatever.h

This will - atleast by default - create a library and few symbolic links like this:

libwhatever.so -> libwhatever.so.0.1.0
libwhatever.so.0 -> libwhatever.so.0.1.0
libwhatever.so.0.1 -> libwhatever.so.0.1.0
libwhatever.so.0.1.0

libwhatever.so.0.1.0 is the actual library binary, the rest of them are just symbolic links.

What i would like to achieve is that no symbolic links are created at all or the order what be other way around so that libwhatever.so would be the actual binary and rest are the symbolic links.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

要走就滚别墨迹 2024-08-02 12:59:49

您可以将以下内容添加到您的专业文件中:

CONFIG += unversioned_libname unversioned_soname

我已经测试成功。

You can add below to your pro file:

CONFIG += unversioned_libname unversioned_soname

I have tested succeed.

怕倦 2024-08-02 12:59:49

如果您使用无操作覆盖 QMAKE_LN_SHLIB 变量,则不会创建符号链接。

QMAKE_LN_SHLIB       = :

If you override the QMAKE_LN_SHLIB variable with a no-op, it will not make the symbolic links.

QMAKE_LN_SHLIB       = :
枯叶蝶 2024-08-02 12:59:49

我尝试了 swarfrat 发布的建议,它有效,但它输出一个错误并带有(相当有用的)消息:

Error 1 (ignored)

因此,这是删除符号链接而不生成任何错误的另一种方法:

unix: QMAKE_POST_LINK = find $DESTDIR -maxdepth 1 -type l -exec rm -f {} \;

可以找到有关此 qmake 变量的更多信息 此处

I tried to suggestion posted by swarfrat and it works but it outputs an error with a (rather helpful) message:

Error 1 (ignored)

So, here is another way of deleting the symlinks without generating any errors:

unix: QMAKE_POST_LINK = find $DESTDIR -maxdepth 1 -type l -exec rm -f {} \;

More information about this qmake variable can be found here.

朦胧时间 2024-08-02 12:59:49

我研究了 qmake 源代码和 mkspecs,但似乎符号链接的生成是相当硬连线的。

从我在源代码中发现的内容来看,似乎如果将 plugin 添加到 CONFIG,则只会生成库,而不会生成符号链接。

不过,我不能告诉你这样做是否有任何其他副作用。 但这似乎是摆脱符号链接而无需编写构建后运行的脚本的唯一方法。

I studied the qmake sources and the mkspecs, but it seems that the generation of the symbolic links is rather hardwired.

From what I found in the sources, it seems that if you add plugin to CONFIG, only the library will be generated, without the symbolic links.

I can't tell you if doing so has any other side effects, though. But it seems to be the only way to get rid of the symbolic links without having to write a script that runs after building.

橘虞初梦 2024-08-02 12:59:49

如果您向我们提供一些关于为什么重要的提示可能会有所帮助...

至于如何,您可能会考虑一个在构建过程结束时运行的脚本,该脚本将根据您的喜好重新排列内容。

It might help if you gave us some hint as to why it matters...

As for how, you might consider a script that will rearrange things to your liking that is run at the end of the build process.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文