mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-17 15:32:10 +08:00
macOS: Add /opt/homebrew to CMAKE_SYSTEM_PREFIX_PATH on Apple Silicon
According to https://brew.sh/2020/12/01/homebrew-2.6.0/ the `/opt/homebrew` directory is recommended for installing ARM architecture brew packages. Fixes: #21585
This commit is contained in:
@@ -216,6 +216,13 @@ set(CMAKE_SYSTEM_APPBUNDLE_PATH
|
|||||||
unset(_apps_paths)
|
unset(_apps_paths)
|
||||||
|
|
||||||
include(Platform/UnixPaths)
|
include(Platform/UnixPaths)
|
||||||
|
|
||||||
|
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64")
|
||||||
|
list(PREPEND CMAKE_SYSTEM_PREFIX_PATH
|
||||||
|
/opt/homebrew # Brew on Apple Silicon
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(_CMAKE_OSX_SYSROOT_PATH)
|
if(_CMAKE_OSX_SYSROOT_PATH)
|
||||||
if(EXISTS ${_CMAKE_OSX_SYSROOT_PATH}/usr/include)
|
if(EXISTS ${_CMAKE_OSX_SYSROOT_PATH}/usr/include)
|
||||||
list(INSERT CMAKE_SYSTEM_PREFIX_PATH 0 ${_CMAKE_OSX_SYSROOT_PATH}/usr)
|
list(INSERT CMAKE_SYSTEM_PREFIX_PATH 0 ${_CMAKE_OSX_SYSROOT_PATH}/usr)
|
||||||
|
Reference in New Issue
Block a user