diff options
author | Jean-Baptiste Noël <jbnoel@gopro.com> | 2022-08-29 17:40:10 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2022-09-01 15:21:43 (GMT) |
commit | 5bfe33f09203448caaf22cea24427692ea295112 (patch) | |
tree | e4d9cffce8b17ab784543f28c3b2260e2ced3cdd /Modules/CMakeFindFrameworks.cmake | |
parent | 8ac6634b2f4ffdafd0b167efc4d17e9dd8bbf212 (diff) | |
download | CMake-5bfe33f09203448caaf22cea24427692ea295112.zip CMake-5bfe33f09203448caaf22cea24427692ea295112.tar.gz CMake-5bfe33f09203448caaf22cea24427692ea295112.tar.bz2 |
CMakeFindFrameworks: Fix Brew 'Frameworks' path on Apple Silicon
This approach is compatible with both Intel and Apple Silicon
architectures.
`/usr/local/Frameworks` was added in commit 9970cdcb59
(CMakeFindFrameworks: Allow custom framework locations, 2016-07-30,
v3.7.0-rc1~296^2) unconditionally, but does not work on Apple Silicon.
```
x86_64 (Intel macOS):
$ brew --prefix
/usr/local
arm64 (Apple Silicon macOS):
$ brew --prefix
/opt/homebrew
```
Diffstat (limited to 'Modules/CMakeFindFrameworks.cmake')
-rw-r--r-- | Modules/CMakeFindFrameworks.cmake | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Modules/CMakeFindFrameworks.cmake b/Modules/CMakeFindFrameworks.cmake index 8906f48..1aa3929 100644 --- a/Modules/CMakeFindFrameworks.cmake +++ b/Modules/CMakeFindFrameworks.cmake @@ -17,12 +17,19 @@ if(NOT CMAKE_FIND_FRAMEWORKS_INCLUDED) macro(CMAKE_FIND_FRAMEWORKS fwk) set(${fwk}_FRAMEWORKS) if(APPLE) + # 'Frameworks' directory from Brew (Apple Silicon and Intel) + if(CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64") + set(_brew_framework_path /opt/homebrew/Frameworks) + else() + set(_brew_framework_path /usr/local/Frameworks) + endif() + file(TO_CMAKE_PATH "$ENV{CMAKE_FRAMEWORK_PATH}" _cmff_CMAKE_FRAMEWORK_PATH) set(_cmff_search_paths ${CMAKE_FRAMEWORK_PATH} ${_cmff_CMAKE_FRAMEWORK_PATH} ~/Library/Frameworks - /usr/local/Frameworks + ${_brew_framework_path} /Library/Frameworks /System/Library/Frameworks /Network/Library/Frameworks |