According to the documentation, CMake should use the values of MACOSX_BUNDLE_BUNDLE_VERSION
and MACOSX_BUNDLE_SHORT_VERSION_STRING
target properties to populate CFBundleVersion
and CFBundleShortVersionString
in the generated Info.plist
.
Here is the example of CMakeLists.txt
I have:
cmake_minimum_required(VERSION 3.12)
project (foo)
set(SOURCES foo.m)
set(HEADERS foo.h)
add_library(foo
SHARED
${SOURCES}
${HEADERS}
)
set_target_properties(foo PROPERTIES
OUTPUT_NAME Foo
FRAMEWORK TRUE
FRAMEWORK_VERSION A
MACOSX_FRAMEWORK_IDENTIFIER test.foo
MACOSX_BUNDLE_SHORT_VERSION_STRING 1.42.0
MACOSX_BUNDLE_BUNDLE_VERSION 1.42.0
MACOSX_RPATH TRUE
# "current version" in semantic format in Mach-O binary file
VERSION 1.42.0
# "compatibility version" in semantic format in Mach-O binary file
SOVERSION 1.42.0
PUBLIC_HEADER "${HEADERS}"
XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT "dwarf-with-dsym"
)
And here is the contents of Foo.framework/Resources/Info.plist
that CMake generates:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>Foo</string>
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>test.foo</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string></string>
<key>CFBundleShortVersionString</key>
<string></string>
<key>CSResourcesFileMapped</key>
<true/>
</dict>
</plist>
So, CFBundleIdentifier
and CFBundleExecutable
are properly replaced, but CFBundleVersion
and CFBundleShortVersionString
are not. What am I missing here?
You should use another set of options as documented here: https://cmake.org/cmake/help/v3.0/prop_tgt/MACOSX_FRAMEWORK_INFO_PLIST.html
that is
MACOSX_FRAMEWORK_SHORT_VERSION_STRING
MACOSX_FRAMEWORK_BUNDLE_VERSION
because in your case it's not a regular bundle, it's a framework (i.e. library in a bundle)