build: add path to Metal compiler for Mac

Try to add the path to the Metal compiler on Mac to `CMAKE_PROGRAM_PATH`
to help it find the Metal compiler.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
This commit is contained in:
Rafael Kitover
2025-07-23 13:12:51 -07:00
parent 3d69bde8cb
commit 3344e7cf71

View File

@@ -83,7 +83,16 @@ if(APPLE)
include(CheckLanguage)
include(MetalShaderSupport)
execute_process(
COMMAND xcode-select -p
OUTPUT_STRIP_TRAILING_WHITESPACE
OUTPUT_VARIABLE xcode_path
)
list(APPEND CMAKE_PROGRAM_PATH "${xcode_path}/Toolchains/XcodeDefault.xctoolchain/usr/bin")
check_language(Metal)
if(CMAKE_Metal_COMPILER)
enable_language(Metal)
endif()