Skip to content

Commit a48b264

Browse files
Merge pull request #652 from basnijholt/arm64
Use CMAKE_SYSTEM_NAME and CMAKE_SYSTEM_PROCESSOR for cross-compiling
2 parents 5416d95 + 4aabe4e commit a48b264

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

CMakeLists.txt

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
11
set(CMAKE_CXX_STANDARD 11)
22
cmake_minimum_required(VERSION 3.11)
33

4-
# Set APPLE_ARM to TRUE if running on Apple Silicon
5-
if(APPLE)
6-
execute_process(COMMAND uname -m OUTPUT_VARIABLE OSX_ARCH OUTPUT_STRIP_TRAILING_WHITESPACE)
7-
if (OSX_ARCH STREQUAL "arm64")
8-
set(APPLE_ARM TRUE)
9-
else() # x86_64
10-
set(APPLE_ARM FALSE)
11-
endif()
4+
# Check if CMAKE_SYSTEM_NAME is Darwin (macOS) and CMAKE_SYSTEM_PROCESSOR is arm64
5+
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64")
6+
set(APPLE_ARM TRUE)
127
else()
138
set(APPLE_ARM FALSE)
14-
endif(APPLE)
9+
endif()
1510

1611
# Set the project name and language
1712
if(APPLE)

0 commit comments

Comments
 (0)