XCode: code signing entitlement file in command line
I managed to have it working by calling:

xcodebuild ... CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO"


and then:

codesign --entitlements .../Entitlements.plist -s signing_identity