iOS Build settings not reflecting xcode project

When I run
cocos compile -p ios
The output shows
running: 'xcodebuild -project ... os.xcodeproj -configuration Debug -target "..." -arch "x86_64" -sdk iphonesimulator CONFIGURATION_BUILD_DIR="..." VALID_ARCHS="i386 x86_64"'

However, my xcode project is set up completely differently to build with arm64 and use iphoneos.

How do i change these settings so using cocos compile -p ios runs the correct settings?

If you want to use CMake to compile, edit your project’s CMake file.

Does using cocos compile -p ios actually use the CmakeLists.txt file?

I’ve tried adding a few different lines to the CMakeLists.txt file to alter these settings but nothing has worked yet.

e.g.

set_target_properties(${APP_NAME} PROPERTIES XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH "NO")

and also tried

set_xcode_property(${APP_NAME} TARGET_ARCH "arm64")

and other similar lines. These didn’t help

You should re-generate your Xcode project after you edited the CMake file.

The XCode project already has the required settings. I think maybe you are misunderstanding my OP.

XCode builds work fine from within XCode. But using cocos compile -p ios runs an xcode build with completely different settings to what is in my xcode project.