title: OpenCV Build - No CMAKE_Swift_COMPILER could be found
body: <p>I'm trying to build an opencv.framework for iOS. But I'm getting this error.</p>
  <p>XCode 13.4.1</p>
  <p>Swift 5.6.1</p>
  <p>CMake 3.23.2</p>
  <p>Device Macbook Air M1</p>
  <pre><code>-- Check for working CXX compiler: /Applications/Xcode-13.4.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ - skipped
  -- Detecting CXX compile features
  -- Detecting CXX compile features - done
  -- The Swift compiler identification is Apple
  CMake Error at CMakeLists.txt:20 (enable_language):
    No CMAKE_Swift_COMPILER could be found.
  
  
  
  -- Configuring incomplete, errors occurred!
  See also &quot;/Users/egehan/Desktop/opcv/ios/build/build-armv7-iphoneos/modules/objc/framework_build/CMakeFiles/CMakeOutput.log&quot;.
  ============================================================
  ERROR: Command '[u'cmake', u'-GXcode', u'-DAPPLE_FRAMEWORK=ON', u'-DCMAKE_INSTALL_PREFIX=install', u'-DCMAKE_BUILD_TYPE=Release', u'-DOPENCV_INCLUDE_INSTALL_PATH=include', u'-DOPENCV_3P_LIB_INSTALL_PATH=lib/3rdparty', u'-DFRAMEWORK_NAME=opencv2', u'-DIOS_ARCH=armv7', u'-DCMAKE_TOOLCHAIN_FILE=/Users/egehan/Desktop/opcv/opencv/platforms/ios/cmake/Toolchains/Toolchain-iPhoneOS_Xcode.cmake', u'-DCPU_BASELINE=DETECT', u'/Users/egehan/Desktop/opcv/ios/build/build-armv7-iphoneos/modules/objc_bindings_generator/ios/gen', u'-DCMAKE_C_FLAGS=-fembed-bitcode', u'-DCMAKE_CXX_FLAGS=-fembed-bitcode', u'-DBUILD_ROOT=/Users/egehan/Desktop/opcv/ios/build/build-armv7-iphoneos', u'-DCMAKE_INSTALL_NAME_TOOL=install_name_tool', u'--no-warn-unused-cli']' returned non-zero exit status 1
  ============================================================
  Traceback (most recent call last):
    File &quot;opencv/platforms/ios/build_framework.py&quot;, line 181, in build
      self._build(outdir)
    File &quot;opencv/platforms/ios/build_framework.py&quot;, line 139, in _build
      self.buildOne(target[0], target[1], main_build_dir, cmake_flags)
    File &quot;opencv/platforms/ios/build_framework.py&quot;, line 327, in buildOne
      execute(cmakecmd, cwd = builddir + &quot;/modules/objc/framework_build&quot;)
    File &quot;/Users/egehan/Desktop/opcv/opencv/platforms/apple/cv_build_utils.py&quot;, line 13, in execute
      retcode = check_call(cmd, cwd = cwd)
    File &quot;/Users/egehan/.pyenv/versions/2.7.18/lib/python2.7/subprocess.py&quot;, line 190, in check_call
      raise CalledProcessError(retcode, cmd)
  CalledProcessError: Command '[u'cmake', u'-GXcode', u'-DAPPLE_FRAMEWORK=ON', u'-DCMAKE_INSTALL_PREFIX=install', u'-DCMAKE_BUILD_TYPE=Release', u'-DOPENCV_INCLUDE_INSTALL_PATH=include', u'-DOPENCV_3P_LIB_INSTALL_PATH=lib/3rdparty', u'-DFRAMEWORK_NAME=opencv2', u'-DIOS_ARCH=armv7', u'-DCMAKE_TOOLCHAIN_FILE=/Users/egehan/Desktop/opcv/opencv/platforms/ios/cmake/Toolchains/Toolchain-iPhoneOS_Xcode.cmake', u'-DCPU_BASELINE=DETECT', u'/Users/egehan/Desktop/opcv/ios/build/build-armv7-iphoneos/modules/objc_bindings_generator/ios/gen', u'-DCMAKE_C_FLAGS=-fembed-bitcode', u'-DCMAKE_CXX_FLAGS=-fembed-bitcode', u'-DBUILD_ROOT=/Users/egehan/Desktop/opcv/ios/build/build-armv7-iphoneos', u'-DCMAKE_INSTALL_NAME_TOOL=install_name_tool', u'--no-warn-unused-cli']' returned non-zero exit status 1
  </code></pre>
  <p>Edit: I tried it with an intel macbook and was able to compile without any problems.</p>