diff options
| author | Johannes Schauer Marin Rodrigues <josch@mister-muffin.de> | 2023-07-23 13:59:07 +0200 |
|---|---|---|
| committer | Johannes Schauer Marin Rodrigues <josch@mister-muffin.de> | 2023-07-23 13:59:07 +0200 |
| commit | dafa5014a4c83ecebc1fe160b104011c7ba8fff9 (patch) | |
| tree | 9f7a8ef1cc8c0a41c33d732793fc36cc3dc2b3cf | |
| parent | 50032affcf022e8e3259324e1a159b51424ef935 (diff) | |
| download | box64-dafa5014a4c83ecebc1fe160b104011c7ba8fff9.tar.gz box64-dafa5014a4c83ecebc1fe160b104011c7ba8fff9.zip | |
Use CMAKE_SYSTEM_PROCESSOR instead of CMAKE_HOST_SYSTEM_PROCESSOR
The former is exactly the same as the latter if compiling natively, which is the output of `uname -m`. But this is the wrong architecture when cross compiling where we do not want the architecture we are compiling on (the build architecture in GNU terminology) but the architecture we are compiling for (the host architecture in GNU terminology). The CMAKE_SYSTEM_PROCESSOR variable is set to the correct host architecture value when cross compiling. With this change, it is possible to cross compile a arm64 executable of box64 on an amd64 machine. Without this change, the "install" target will be omitted, because CMakeLists.txt wrongly uses the build architecture to decide whether the install target should be added or not. Instead it should use the host architecture.
| -rw-r--r-- | CMakeLists.txt | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index fa2d833a..3482859d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -746,10 +746,10 @@ else() endif() endif() -string(COMPARE EQUAL "${CMAKE_HOST_SYSTEM_PROCESSOR}" "i686" _x86) -string(COMPARE EQUAL "${CMAKE_HOST_SYSTEM_PROCESSOR}" "x86_64" _x86_64) -string(COMPARE EQUAL "${CMAKE_HOST_SYSTEM_PROCESSOR}" "aarch64" _aarch64) -string(COMPARE EQUAL "${CMAKE_HOST_SYSTEM_PROCESSOR}" "riscv64" _riscv64) +string(COMPARE EQUAL "${CMAKE_SYSTEM_PROCESSOR}" "i686" _x86) +string(COMPARE EQUAL "${CMAKE_SYSTEM_PROCESSOR}" "x86_64" _x86_64) +string(COMPARE EQUAL "${CMAKE_SYSTEM_PROCESSOR}" "aarch64" _aarch64) +string(COMPARE EQUAL "${CMAKE_SYSTEM_PROCESSOR}" "riscv64" _riscv64) if(_x86_64 OR _aarch64) add_definitions(-DCONFIG_64BIT) |