Skip to content

Commit

Permalink
Fix CMake detection of cross-compilers on arm/arm64 build arch (#35084)
Browse files Browse the repository at this point in the history
Signed-off-by: Vasyl Gello <vasek.gello@gmail.com>
  • Loading branch information
basilgello authored Dec 5, 2023
1 parent 3035d07 commit aa628ce
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions scripts/toolchains/linux.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86")
string(APPEND VCPKG_LINKER_FLAGS " -m32")
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm")
set(CMAKE_SYSTEM_PROCESSOR armv7l CACHE STRING "")
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "x86_64")
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux")
if(NOT DEFINED CMAKE_CXX_COMPILER)
set(CMAKE_CXX_COMPILER "arm-linux-gnueabihf-g++")
endif()
Expand All @@ -25,12 +25,12 @@ elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm")
endif()
if(NOT DEFINED CMAKE_ASM-ATT_COMPILER)
set(CMAKE_ASM-ATT_COMPILER "arm-linux-gnueabihf-as")
endif()
message(STATUS "Cross compiling arm on host x86_64, use cross compiler: ${CMAKE_CXX_COMPILER}/${CMAKE_C_COMPILER}")
endif()
message(STATUS "Cross compiling arm on host ${CMAKE_HOST_SYSTEM_PROCESSOR}, use cross compiler: ${CMAKE_CXX_COMPILER}/${CMAKE_C_COMPILER}")
endif()
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
set(CMAKE_SYSTEM_PROCESSOR aarch64 CACHE STRING "")
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "x86_64")
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux")
if(NOT DEFINED CMAKE_CXX_COMPILER)
set(CMAKE_CXX_COMPILER "aarch64-linux-gnu-g++")
endif()
Expand All @@ -42,8 +42,8 @@ elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
endif()
if(NOT DEFINED CMAKE_ASM-ATT_COMPILER)
set(CMAKE_ASM-ATT_COMPILER "aarch64-linux-gnu-as")
endif()
message(STATUS "Cross compiling arm64 on host x86_64, use cross compiler: ${CMAKE_CXX_COMPILER}/${CMAKE_C_COMPILER}")
endif()
message(STATUS "Cross compiling arm64 on host ${CMAKE_HOST_SYSTEM_PROCESSOR}, use cross compiler: ${CMAKE_CXX_COMPILER}/${CMAKE_C_COMPILER}")
endif()
endif()

Expand Down

0 comments on commit aa628ce

Please sign in to comment.