CMAKE_SYSTEM_PROCESSOR is overwritten
I'm trying to use cmake with different toolchain files to compile a library on Mac OS for armv7, armv7s, i386 and x86_64. Using toolchain files works fine, except I have to link with different libraries/frameworks based on the architecture/build. I was thinking that using CMAKE_SYSTEM_PROCESSOR was the right choice but I'm not entirely sure anymore.
When I set the CMAKE_SYSTEM_PROCESSOR in my toolchain file it's always reset to
x86_64 in my CMakeLists.txt (and external projects). I've tried using CACHED and non-cached variables. I've created a repository that can be used to reproduce the issue: https://github.com/roxlu/cmake_multi_arch
But besides this issue, I'm not sure how to handle building for the iOS simulator. When building for the iOS simulator one uses x86_64 (so CMAKE_SYSTEM_PROCESSOR would be x86_64) but I would still need to link with different libraries which are only available for iOS. In this case checking for x86_64 wouldn't be enough. Are there other options?