Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(I can't believe that this is the best way to do this, but I'm not seeing a lot of options for how to get the version number into Info.plist!) Qt no longer adds the deprecated CFBundleGetInfoString. That string was deprecated since macOS 10.5, and should not have been used: https://bugreports.qt.io/browse/QTBUG-74872 When I added it: 2018-08-16 build: add VERSION to the osx app bundle https://bugreports.qt.io/browse/QTBUG-74872 I did not understand the situation. According to: https://developer.apple.com/documentation/bundleresources/information_property_list/cfbundleversion https://developer.apple.com/documentation/bundleresources/information_property_list/cfbundleshortversionstring those property list keys were introduced in 10.0 (2001-03-24), so we don't need to worry about whether older versions of macOS support it. Unfortunately, /usr/libexec/PlistBuddy is rather temperamental. It allows one to "Add" or "Set", but both commands fail if the key already exists or does not exist (as appropriate). As such, if we hard-code "Set" then it fails immediately. If we hard-code "Add" then it succeeds on the first compilation but fails after a second (i.e. `make && touch src/main.cpp && make` fails). It appears that the "Merge" command will give a warning if the key already exists, but this is only a warning, not a failure. So our strategy is to merge the CFBundleVersionString and CFBundleShortVersionString keys, then to "Set" them. One solution which I read about, but rejected, was to create an Info.plist file, then use that instead of the qmake-generated one. We could then use sed (or the undocumented QMAKE_SUBSITUTES?) to add the version number. However, that would also require us to specify values for keys such as LSMinimumSystemVersion and NSPrincipalClass, and presumably modify them as appropriate for different versions of macOS, the system libraries, compiler, etc. I will happily admit that I trust qmake's default values more than my own knowledge of macOS.
- Loading branch information