No prompt for mic access..?

I can’t for the life of me enabled mic access? My GUI app has the following settings in its CMake file:

juce_add_gui_app(${PROJECT_NAME}
        HARDENED_RUNTIME_ENABLED TRUE
        COMPANY_NAME ${JucePlugin_Manufacturer}
        MICROPHONE_PERMISSION_ENABLED TRUE
        MICROPHONE_PERMISSION_TEXT "Cabbage needs access to your audio interface" 
        PRODUCT_NAME ${PROJECT_NAME})     # The name of the final executable, which can differ from the target name

Yet, it never prompts me for permission to use the mic. I’ve reset the security settings for the mic, ala:
tccutil reset Microphone. I’ve nuked the build folder and ran CMake from scratch, but still no luck. Is there anything else I need do? I’m on an M1 Mac, Big Sur, if that makes any difference.

Given that you have the hardened runtime enabled, you’ll also need to set

HARDENED_RUNTIME_OPTIONS com.apple.security.device.audio-input

Thanks @reuk I was doing this, but further down in my CMake script I was overwriting it :see_no_evil:

I’m trying to get mic input working on an audio app using CMake. I’m setting the following options in juce_add_gui_app:

        MICROPHONE_PERMISSION_ENABLED TRUE
        MICROPHONE_PERMISSION_TEXT "Amazing Audio App needs access to your audio interface"
        HARDENED_RUNTIME_ENABLED TRUE
        HARDENED_RUNTIME_OPTIONS com.apple.security.device.audio-input

If I create a Release build, it asks for the permission and then audio input works.

However, when I run a build on my CI server which also packages it in a DMG and notarizes it, it doesn’t work.

Any ideas?

A good first step is to try to find out if the app is telling you what’s wrong. If you run your final app under a debugger, does it print any diagnostic messages when it fails to open the microphone? Are there any messages from your application in Console.app?

Given the nature of the issue, I think there’s a chance that signing/entitlements are at fault, so you could try running

codesign --display --entitlements :- YourApp.app

on the two versions of your app, and check whether there are any differences. If there are, then it’s likely that there’s an issue in the signing of the final distributable, and you can then try inspecting the codesign commands run by your CI machine to see where the entitlements are going missing.