So I finally settled on using a swift package to handle the command line tool project, which I added to the main app project using the package dependencies. This package executable product could be set as a dependency, and I added a run script build phase to sign the tool and embed it in the main app's Resources folder.
The SPM executable product needs to be signed with --options=runtime to be embedded in a notarized macOS app. The script is pretty simple:
#!/bin/bash
devID="Developer ID Application: Me Myself (ASDF1234)"
toolPath="${BUILT_PRODUCTS_DIR}/MyTool"
codesign --force --options=runtime --sign "${devID}" "${toolPath}"
cp "${toolPath}" "${CONFIGURATION_BUILD_DIR}/${CONTENTS_FOLDER_PATH}/Resources"
Topic:
Developer Tools & Services
SubTopic:
Xcode
Tags: