【发布时间】:2018-09-12 15:06:37
【问题描述】:
根据documentation,CMake应该使用MACOSX_BUNDLE_BUNDLE_VERSION和MACOSX_BUNDLE_SHORT_VERSION_STRING目标属性的值来填充CFBundleVersion和CFBundleShortVersionString在生成的Info.plist中。
这是CMakeLists.txt的例子我有:
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"
)
这是 CMake 生成的Foo.framework/Resources/Info.plist 的内容:
<?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>
所以,CFBundleIdentifier 和 CFBundleExecutable 被正确替换,但 CFBundleVersion 和 CFBundleShortVersionString 不是。我在这里错过了什么?
【问题讨论】:
标签: cmake info.plist