mstorsjo wrote:

> > When cross compiling LLVM, I never have set `CMAKE_SYSTEM_PROCESSOR` so 
> > far, since we don't really have anything that uses it (before this), which 
> > means that this expands to an empty string. I guess I should set it still 
> > though.
> 
> Yes, I am just getting used to it as well. I think it's worth noting that 
> this should be set in a toolchain file, because CMake seems to have special 
> handling for them. When I pass `-DCMAKE_SYSTEM_PROCESSOR=ARM` at 
> configuration time, it gets overwritten with my host arch.

I think that's (somewhat?) expected. When you're not cross compiling, cmake 
explicitly sets `CMAKE_SYSTEM_PROCESSOR` to `CMAKE_HOST_SYSTEM_PROCESSOR`, 
ignoring whatever you set manually. (Dunno if it would make any difference if 
you'd set it in a toolchain file.) Only if you're cross compiling (which CMake 
defines as if you're setting `CMAKE_SYSTEM_NAME`, regardless if cross compiling 
from Linux to Linux on another arch), it doesn't set it and passes whatever you 
set originally through.

This actually makes `CMAKE_SYSTEM_PROCESSOR` a bit problematic; if you're on 
x86_64 but targeting i386, or on aarch64 but targeting arm, you might not want 
to consider it a cross build (as you can execute the build products) but CMake 
then will hide whatever you're really targeting with the info gathered from the 
host environment.

https://github.com/llvm/llvm-project/pull/78959
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to