Set ad-hoc signing in Projucer?

Is there a way to use ad-hoc signing (pseudo-identity) from the Projucer?

I mean something to do that:

codesign    --options runtime \
            --entitlements ./resources/Spaghettis.entitlements \
            --deep -s "-" "${app}"

Note that if i use “Hardened Runtime Options” without a valid ID i get in Xcode:

Code Signing Warning: "Spaghettis - App" isn't code signed but requires entitlements. It is not possible to add entitlements to a binary without signing it.

(I guess that i will have to use a shell script, but a way to do it without would be better).

Ok, in Xcode 12 i can use “Sign to Run Locally”. Is it possible to select this way from the Projucer?

CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = "";

FYI a workaround:

In Projucer let “Use Hardened Runtime” option set to Disabled.
Add a “Post-Build Shell Script”.
For instance, mine is bellow.

rep="${SOURCE_ROOT}/../.."
app="${BUILT_PRODUCTS_DIR}/Spaghettis.app"
entitlements="${rep}/Resources/Spaghettis.entitlements"
codesign --options runtime --entitlements "${entitlements}" --deep -s "-" "${app}"  || exit 1
1 Like

You can put

CODE_SIGN_IDENTITY="-", CODE_SIGN_STYLE=Automatic, DEVELOPMENT_TEAM=""

in the “Custom Xcode Flags” fields of Projucer.

2 Likes

Thanks! It works fine also. A good trick to know for future similar problems. :smile: