Skip to content

Commit

Permalink
Fix x86 detection in conan_provider.cmake
Browse files Browse the repository at this point in the history
Merged changes from conan-io/cmake-conan#525
  • Loading branch information
valgur committed May 1, 2024
1 parent 93f9501 commit 9a797eb
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions cmake/conan_provider.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,22 @@ function(detect_arch ARCH)
message(WARNING "CMake-Conan: Multiple architectures detected, this will only work if Conan recipe(s) produce fat binaries.")
endif()
endif()
if(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|ARM64|arm64" OR CMAKE_OSX_ARCHITECTURES MATCHES arm64)
if(CMAKE_SYSTEM_NAME MATCHES "Darwin|iOS|tvOS|watchOS")
set(host_arch ${CMAKE_OSX_ARCHITECTURES})
elseif(MSVC)
set(host_arch ${CMAKE_CXX_COMPILER_ARCHITECTURE_ID})
else()
set(host_arch ${CMAKE_SYSTEM_PROCESSOR})
endif()
if(host_arch MATCHES "aarch64|arm64|ARM64")
set(_ARCH armv8)
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "armv7-a|armv7l" OR CMAKE_OSX_ARCHITECTURES MATCHES armv7)
elseif(host_arch MATCHES "armv7|armv7-a|armv7l|ARMV7")
set(_ARCH armv7)
elseif(CMAKE_OSX_ARCHITECTURES MATCHES armv7s)
elseif(host_arch MATCHES armv7s)
set(_ARCH armv7s)
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "i686" OR CMAKE_OSX_ARCHITECTURES MATCHES i386)
elseif(host_arch MATCHES "i686|i386|X86")
set(_ARCH x86)
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "AMD64|amd64|x86_64" OR CMAKE_OSX_ARCHITECTURES MATCHES x86_64)
elseif(host_arch MATCHES "AMD64|amd64|x86_64|x64")
set(_ARCH x86_64)
endif()
message(STATUS "CMake-Conan: cmake_system_processor=${_ARCH}")
Expand Down

0 comments on commit 9a797eb

Please sign in to comment.