diff --git a/conan_provider.cmake b/conan_provider.cmake index 6c311582..b86ed0b0 100644 --- a/conan_provider.cmake +++ b/conan_provider.cmake @@ -30,13 +30,13 @@ endfunction() function(detect_arch ARCH) - if(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|ARM64|arm64") + if(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|ARM64|arm64" OR CMAKE_GENERATOR_PLATFORM STREQUAL ARM64) set(_ARCH armv8) - elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "armv7-a|armv7l") + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "armv7-a|armv7l" OR CMAKE_GENERATOR_PLATFORM STREQUAL ARM) set(_ARCH armv7) - elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "i686") + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "i686" OR CMAKE_GENERATOR_PLATFORM STREQUAL Win32) set(_ARCH x86) - elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "AMD64|amd64|x86_64") + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "AMD64|amd64|x86_64" OR CMAKE_GENERATOR_PLATFORM STREQUAL x64) set(_ARCH x86_64) endif() message(STATUS "CMake-Conan: cmake_system_processor=${_ARCH}") diff --git a/tests/test_smoke.py b/tests/test_smoke.py index 2f1b77cb..7a3dea6e 100644 --- a/tests/test_smoke.py +++ b/tests/test_smoke.py @@ -242,3 +242,33 @@ def test_android_x86(self, capfd, chdir_build): assert "os=Android" in out assert "os.api_level=19" in out assert "tools.android:ndk_path=" in out + +class TestMSVCArch: + @pytest.fixture(scope="class", autouse=True) + def android_setup(self): + shutil.rmtree("build") + yield + + @windows + def test_msvc_arm64(self, capfd, chdir_build): + run('cmake .. --fresh -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=conan_provider.cmake -G "Visual Studio 16 2019" -A ARM64') + out, _ = capfd.readouterr() + assert "arch=armv8" in out + + @windows + def test_msvc_arm(self, capfd, chdir_build): + run('cmake .. --fresh -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=conan_provider.cmake -G "Visual Studio 16 2019" -A ARM') + out, _ = capfd.readouterr() + assert "arch=armv7" in out + + @windows + def test_msvc_x86_64(self, capfd, chdir_build): + run('cmake .. --fresh -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=conan_provider.cmake -G "Visual Studio 16 2019" -A x64') + out, _ = capfd.readouterr() + assert "arch=x86_64" in out + + @windows + def test_msvc_x86(self, capfd, chdir_build): + run('cmake .. --fresh -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=conan_provider.cmake -G "Visual Studio 16 2019" -A Win32') + out, _ = capfd.readouterr() + assert "arch=x86" in out