Skip to content

Commit

Permalink
Merge pull request #652 from basnijholt/arm64
Browse files Browse the repository at this point in the history
Use CMAKE_SYSTEM_NAME and CMAKE_SYSTEM_PROCESSOR for cross-compiling
  • Loading branch information
NoureldinYosri authored Jan 31, 2024
2 parents 5416d95 + 4aabe4e commit a48b264
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
set(CMAKE_CXX_STANDARD 11)
cmake_minimum_required(VERSION 3.11)

# Set APPLE_ARM to TRUE if running on Apple Silicon
if(APPLE)
execute_process(COMMAND uname -m OUTPUT_VARIABLE OSX_ARCH OUTPUT_STRIP_TRAILING_WHITESPACE)
if (OSX_ARCH STREQUAL "arm64")
set(APPLE_ARM TRUE)
else() # x86_64
set(APPLE_ARM FALSE)
endif()
# Check if CMAKE_SYSTEM_NAME is Darwin (macOS) and CMAKE_SYSTEM_PROCESSOR is arm64
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64")
set(APPLE_ARM TRUE)
else()
set(APPLE_ARM FALSE)
endif(APPLE)
endif()

# Set the project name and language
if(APPLE)
Expand Down

0 comments on commit a48b264

Please sign in to comment.