Skip to content

Instantly share code, notes, and snippets.

@torarnv
Created September 20, 2019 12:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save torarnv/60cbcddd51b91c46ccf8fa2f18a79dc4 to your computer and use it in GitHub Desktop.
Save torarnv/60cbcddd51b91c46ccf8fa2f18a79dc4 to your computer and use it in GitHub Desktop.
diff --git i/mkspecs/features/mac/default_post.prf w/mkspecs/features/mac/default_post.prf
index 993f4d56a9..904cdfb9d9 100644
--- i/mkspecs/features/mac/default_post.prf
+++ w/mkspecs/features/mac/default_post.prf
@@ -106,12 +106,17 @@ macx-xcode {
VER_PAT = $$member(l, 2, 2)
unset(l)
+ # The CFBundleVersion should be of the form x.y.x with an optional
+ # suffix, eg. 1.0.0a3, version 1.0.0 alpha 3, so we include the whole
+ # VERSION.
qmake_full_version.name = QMAKE_FULL_VERSION
- qmake_full_version.value = $${VER_MAJ}.$${VER_MIN}.$${VER_PAT}
+ qmake_full_version.value = $$bundle_version
QMAKE_MAC_XCODE_SETTINGS += qmake_full_version
+ # The CFBundleShortVersionString is the user-visible string for the
+ # version, in the form x.y.z.
qmake_short_version.name = QMAKE_SHORT_VERSION
- qmake_short_version.value = $${VER_MAJ}.$${VER_MIN}
+ qmake_short_version.value = $${VER_MAJ}.$${VER_MIN}.$${VER_PAT}
QMAKE_MAC_XCODE_SETTINGS += qmake_short_version
!isEmpty(QMAKE_XCODE_DEBUG_INFORMATION_FORMAT) {
diff --git i/qmake/doc/src/qmake-manual.qdoc w/qmake/doc/src/qmake-manual.qdoc
index 3495f97b2c..4372a1f9a4 100644
--- i/qmake/doc/src/qmake-manual.qdoc
+++ w/qmake/doc/src/qmake-manual.qdoc
@@ -1986,10 +1986,10 @@
\li Expands to the value of QMAKE_PKGINFO_TYPEINFO.
\row
\li \c ${QMAKE_FULL_VERSION}, \c @FULL_VERSION@
- \li Expands to the value of VERSION expressed with three version components.
+ \li Expands to the value of VERSION.
\row
\li \c ${QMAKE_SHORT_VERSION}, \c @SHORT_VERSION@
- \li Expands to the value of VERSION expressed with two version components.
+ \li Expands to the value of VERSION expressed with three version components.
\row
\li \c ${MACOSX_DEPLOYMENT_TARGET}
\li Expands to the value of QMAKE_MACOSX_DEPLOYMENT_TARGET.
diff --git i/qmake/generators/mac/pbuilder_pbx.cpp w/qmake/generators/mac/pbuilder_pbx.cpp
index 24e69444c9..5ef2b3e771 100644
--- i/qmake/generators/mac/pbuilder_pbx.cpp
+++ w/qmake/generators/mac/pbuilder_pbx.cpp
@@ -1610,7 +1610,8 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
bundlePrefix = "com.yourcompany";
plist_in_text.replace(QLatin1String("@BUNDLEIDENTIFIER@"), bundlePrefix + '.' + QLatin1String("${PRODUCT_NAME:rfc1034identifier}"));
if (!project->values("VERSION").isEmpty()) {
- plist_in_text.replace(QLatin1String("@SHORT_VERSION@"), project->first("VER_MAJ") + "." + project->first("VER_MIN"));
+ plist_in_text.replace(QLatin1String("@SHORT_VERSION@"), project->first("VER_MAJ")
+ + "." + project->first("VER_MIN"), + "." + project->first("VER_PAT"));
}
plist_in_text.replace(QLatin1String("@TYPEINFO@"),
(project->isEmpty("QMAKE_PKGINFO_TYPEINFO")
diff --git i/qmake/generators/unix/unixmake2.cpp w/qmake/generators/unix/unixmake2.cpp
index ccb601d4b8..3d59fa46fa 100644
--- i/qmake/generators/unix/unixmake2.cpp
+++ w/qmake/generators/unix/unixmake2.cpp
@@ -789,14 +789,12 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
ProStringList commonSedArgs;
if (!project->values("VERSION").isEmpty()) {
const ProString shortVersion =
- project->first("VER_MAJ") + "." +
- project->first("VER_MIN");
- commonSedArgs << "-e \"s,@SHORT_VERSION@," << shortVersion << ",g\" ";
- commonSedArgs << "-e \"s,\\$${QMAKE_SHORT_VERSION}," << shortVersion << ",g\" ";
- const ProString fullVersion =
project->first("VER_MAJ") + "." +
project->first("VER_MIN") + "." +
project->first("VER_PAT");
+ commonSedArgs << "-e \"s,@SHORT_VERSION@," << shortVersion << ",g\" ";
+ commonSedArgs << "-e \"s,\\$${QMAKE_SHORT_VERSION}," << shortVersion << ",g\" ";
+ const ProString fullVersion = project->first("VERSION");
commonSedArgs << "-e \"s,@FULL_VERSION@," << fullVersion << ",g\" ";
commonSedArgs << "-e \"s,\\$${QMAKE_FULL_VERSION}," << fullVersion << ",g\" ";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment