Qt: VERSION与qmake中VER_MAJ、VER_MIN、VER_PAT的区别
Qt: difference between VERSION and VER_MAJ, VER_MIN, VER_PAT in qmake
我正在使用 linux 作为 Qt5 中的共享库。
自从在 .pro
中使用以下任何一个:
VERSION = 1.2.3
或
VER_MAJ = 1
VER_MIN = 2
VER_PAT = 3
为库生成相同的输出名称(lib.so、lib.so.1、lib.so.1.2、lib.so.1.2.3),实际是什么区别?
Qt 文档指出:
VERSION Specifies the version number of the application if the app
template is specified or the version number of the library if the lib
template is specified.
VER_MAJ Specifies the major version number of the library if the lib
template is specified.
VER_MIN Specifies the minor version number of the library if the lib
template is specified.
VER_PAT Specifies the patch version number of the library if the lib
template is specified.
因为我没有使用 app
模板,两者是一样的吗?为什么我应该更喜欢其中之一?
编辑:在 che 库版本输出的定义中,似乎 VER_MAJ, VER_MIN, VER_PAT
总是优先于 VERSION
,无论定义顺序如何。
Qt documentation states
关于 qmake
,至少可以说,Qt 文档并不十分准确。人们应该经常查阅 qmake
的源代码以找出真相。
所以在深入研究源代码之后,它看起来像:
- Win:
VERSION
用于 Windows 资源(应用程序和库); VER_MAJ
仅用于共享库后缀(例如 "mylib1.dll");如果未设置 VER_MAJ
,则从 VERSION
初始化; VER_MIN
和 VER_PAT
被忽略。
- *nix:
VERSION
被忽略,除非某些 VER_MAJ
、VER_MIN
或 VER_PAT
未设置直接,然后它们从 VERSION
. 间接初始化
因此,对于 Win,应该只使用 VERSION
。对于 *nix,没有真正的区别。
我正在使用 linux 作为 Qt5 中的共享库。
自从在 .pro
中使用以下任何一个:
VERSION = 1.2.3
或
VER_MAJ = 1
VER_MIN = 2
VER_PAT = 3
为库生成相同的输出名称(lib.so、lib.so.1、lib.so.1.2、lib.so.1.2.3),实际是什么区别?
Qt 文档指出:
VERSION Specifies the version number of the application if the app template is specified or the version number of the library if the lib template is specified.
VER_MAJ Specifies the major version number of the library if the lib template is specified.
VER_MIN Specifies the minor version number of the library if the lib template is specified.
VER_PAT Specifies the patch version number of the library if the lib template is specified.
因为我没有使用 app
模板,两者是一样的吗?为什么我应该更喜欢其中之一?
编辑:在 che 库版本输出的定义中,似乎 VER_MAJ, VER_MIN, VER_PAT
总是优先于 VERSION
,无论定义顺序如何。
Qt documentation states
关于 qmake
,至少可以说,Qt 文档并不十分准确。人们应该经常查阅 qmake
的源代码以找出真相。
所以在深入研究源代码之后,它看起来像:
- Win:
VERSION
用于 Windows 资源(应用程序和库);VER_MAJ
仅用于共享库后缀(例如 "mylib1.dll");如果未设置VER_MAJ
,则从VERSION
初始化;VER_MIN
和VER_PAT
被忽略。 - *nix:
VERSION
被忽略,除非某些VER_MAJ
、VER_MIN
或VER_PAT
未设置直接,然后它们从VERSION
. 间接初始化
因此,对于 Win,应该只使用 VERSION
。对于 *nix,没有真正的区别。