[swift-users] [Swift Package Manager] Use of Info-plist; use for apps

Quinn "The Eskimo!" eskimo1 at apple.com
Tue Aug 22 02:30:43 CDT 2017


On 22 Aug 2017, at 06:13, Daryle Walker via swift-users <swift-users at swift.org> wrote:

> I recall there’s a way to make a command-line tool in macOS have an “Info.plist” file, which is compiled/linked in the executable’s data segment.

Correct.  Xcode has explicit support for this, namely the “Create Info.plist Section in Binary” build setting (`CREATE_INFOPLIST_SECTION_IN_BINARY`).  This uses the file from the standard “Info.plist File” (`INFOPLIST_FILE`) build setting.

> Is there a way to do this through “swift build”?

The above is implemented in terms of the `-sectcreate __TEXT __info_plist /path/to/file` linker option, which you can read about in <x-man-page://1/ld>.  If you create a dummy Xcode command line tool project, you can look at the build transcript to see how it works.

I kinda presume that SPM has a way to pass in custom linker options but I don’t have direct experience with that.

Share and Enjoy
--
Quinn "The Eskimo!"                    <http://www.apple.com/developer/>
Apple Developer Relations, Developer Technical Support, Core OS/Hardware




More information about the swift-users mailing list