-
Notifications
You must be signed in to change notification settings - Fork 1
/
homebrewClang.cmake
31 lines (25 loc) · 1.07 KB
/
homebrewClang.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
if (APPLE AND NOT (VCPKG_TARGET_TRIPLET MATCHES "android" OR VCPKG_TARGET_TRIPLET MATCHES "linux"))
message(STATUS "APPLE is defined")
set(HOMEBREW_PREFIX $ENV{HOMEBREW_PREFIX})
set(LLVM_PREFIX "${HOMEBREW_PREFIX}")
set(CMAKE_C_COMPILER "${LLVM_PREFIX}/bin/clang")
set(CMAKE_CXX_COMPILER "${LLVM_PREFIX}/bin/clang++")
set(ENV{CC} "${CMAKE_C_COMPILER}")
set(ENV{CXX} "${CMAKE_CXX_COMPILER}")
set(CMAKE_PREFIX_PATH
"${LLVM_PREFIX}"
"${HOMEBREW_PREFIX}"
)
list(TRANSFORM CMAKE_PREFIX_PATH APPEND "/include"
OUTPUT_VARIABLE CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES)
set(CMAKE_C_STANDARD_INCLUDE_DIRECTORIES "${CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES}")
if (NOT (VCPKG_TARGET_TRIPLET MATCHES "ios"))
set(CMAKE_FIND_FRAMEWORK LAST)
set(CMAKE_FIND_APPBUNDLE LAST)
add_link_options("-L/opt/homebrew/lib/c++" "-Wl,-rpath,/opt/homebrew/lib/c++")
endif()
if (VCPKG_TARGET_TRIPLET MATCHES "ios")
set(CMAKE_FIND_FRAMEWORK FIRST)
set(CMAKE_FIND_APPBUNDLE FIRST)
endif()
endif()