Getting past gatekeeper on macOS?

macOS 13.1

I’m trying to cross-compile for RISC-V, and the clang that comes with Xcode doesn’t support other targets.

So I downloaded the latest 15.0.7 release and tried to run it, but gatekeeper gets in the way.

I was able to enable the clang executable by right-clicking it in the Finder and choosing Open, but I don’t want to have to do that for every executable.

So I tried

$ spctl --add /usr/local/clang+llvm-15.0.7-arm64-apple-darwin22.0/bin/*

This spent 10 seconds doing stuff, but in the end didn’t help; I still get challenged for the other executables.

Then I tried

$ spctl developer-mode enable-terminal
Terminal added as a developer tool. Enable in the Privacy & Security Settings.

At first that didn’t work, but then I noticed the bit about enabling it in Privacy & Security Settings. After I flipped that switch on, I now seem to be able to execute those binaries.

Is this the right way to do this? TIA…