Skip to end of banner
Go to start of banner

CMake issue with emulated Powershell

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Problem

CMake provides a built-in flag CMAKE_SYSTEM_PROCESSOR to specify the target platform for the build.

https://cmake.org/cmake/help/latest/variable/CMAKE_SYSTEM_PROCESSOR.html

If CMake is invoked from a non-native Powershell or other terminals then this flag could be set wrongly. CMAKE_SYSTEM_PROCESSOR flag is derived from environment variables PROCESSOR_ARCHITECTURE and PROCESSOR_ARCHITEW6432. And for emulated Powershell, the environment variables could be set to AMD64 or IA32 and CMAKE_SYSTEM_PROCESSOR derives the wrong value.

And if your CMake project uses CMAKE_SYSTEM_PROCESSOR for platform-specific configuration it might fail.

Solution

Powershell provided with the default windows installer is not a native Arm64 binary but a native build can be downloaded from https://github.com/PowerShell/PowerShell/releases/tag/v7.0.2

  • No labels