diff options
author | MichaĆ Janiszewski <janisozaur@users.noreply.github.com> | 2021-05-07 15:08:24 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-07 14:08:24 +0100 |
commit | 17948a78ee4137e15fcdbfecdfee27f8eca279f8 (patch) | |
tree | 0591444ba9a54ae74a15792f609a8d32c086716d | |
parent | a53b8853aa329825d1177e35416e1b4107d81879 (diff) | |
download | google-benchmark-17948a78ee4137e15fcdbfecdfee27f8eca279f8.tar.gz |
Add MSVC ARM64 support to cmake (#1090)
-rw-r--r-- | CMakeLists.txt | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 77b3723..9e68d39 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,6 +37,17 @@ option(BENCHMARK_ENABLE_GTEST_TESTS "Enable building the unit tests which depend option(BENCHMARK_ENABLE_LIBPFM "Enable performance counters provided by libpfm" OFF) set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) +if(MSVC) + # As of CMake 3.18, CMAKE_SYSTEM_PROCESSOR is not set properly for MSVC and + # cross-compilation (e.g. Host=x86_64, target=aarch64) requires using the + # undocumented, but working variable. + # See https://gitlab.kitware.com/cmake/cmake/-/issues/15170 + set(CMAKE_SYSTEM_PROCESSOR ${MSVC_CXX_ARCHITECTURE_ID}) + if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "ARM") + set(CMAKE_CROSSCOMPILING TRUE) + endif() +endif() + set(ENABLE_ASSEMBLY_TESTS_DEFAULT OFF) function(should_enable_assembly_tests) if(CMAKE_BUILD_TYPE) |