Skip to content

Commit

Permalink
Update CMakeLists to build for native macOS arch
Browse files Browse the repository at this point in the history
  • Loading branch information
ideoforms committed Jan 26, 2024
1 parent 4bd8174 commit bff9f0e
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,19 @@ if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Develop)
endif()

#-------------------------------------------------------------------------------
# By default, build arm64 on Apple.
#-------------------------------------------------------------------------------
if (NOT CMAKE_OSX_ARCHITECTURES)
set(CMAKE_OSX_ARCHITECTURES "arm64")
endif()

if (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
#-------------------------------------------------------------------------------
# On Apple, build the current native system by default
#-------------------------------------------------------------------------------
if (NOT CMAKE_OSX_ARCHITECTURES)
execute_process(COMMAND uname -m
OUTPUT_VARIABLE CMAKE_OSX_ARCHITECTURES
OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()

#-------------------------------------------------------------------------------
# Select the appropriate homebrew prefix by architecture
#-------------------------------------------------------------------------------
if (CMAKE_OSX_ARCHITECTURES STREQUAL "arm64")
set(CMAKE_PREFIX_PATH /opt/homebrew)
else()
Expand Down

0 comments on commit bff9f0e

Please sign in to comment.