Skip to content

Commit 51775cc

Browse files
committed
[Metal] Calculate CMAKE_OSX_SYSROOT if it's not set
1 parent 5228f00 commit 51775cc

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

cpp/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,11 @@ elseif(USE_BACKEND STREQUAL "METAL")
108108
message(FATAL_ERROR "Project requires building with AppleClang. Have ${CMAKE_CXX_COMPILER_ID}")
109109
endif()
110110
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/external/macos/cmake/modules")
111+
112+
if (NOT CMAKE_OSX_SYSROOT)
113+
execute_process(COMMAND xcrun --show-sdk-path OUTPUT_VARIABLE CMAKE_OSX_SYSROOT OUTPUT_STRIP_TRAILING_WHITESPACE)
114+
endif()
115+
111116
include(InitializeSwift)
112117
include(AddSwift)
113118
set(CMAKE_OSX_DEPLOYMENT_TARGET 13.0)

0 commit comments

Comments
 (0)