How to compile contrib modules with build_xcframework.py that require additional CMake arguments

Greetings.

I am attempting to build OpenCV 4.6.0 as a framework file in macOS. Normally, I simply use the build_xcframework.py or build_framework.py files that came with the source under the apple/osx folders due to its convenience. This time around, I want to include some contrib modules to the build such as xfeatures2D and sfm. By doing so, complications come up due to the sfm module requiring several dependencies such as ceres, glog, and gflags. Then, using CMake, you specify the paths to the dependencies.

Reading the python file(s), I see no argument(s) that allow us to pass additional CMake specific variables and corresponding values. I’m wondering if this is even possible to do via the build_xcframework / build_framework files or do I have to resort to build the source files as a set of static libraries through CMake and painfully link these files and headers manually to my project.

Thank you in advance.