File tree Expand file tree Collapse file tree 2 files changed +17
-5
lines changed Expand file tree Collapse file tree 2 files changed +17
-5
lines changed Original file line number Diff line number Diff line change 1+ # Used for CMake toolchain setup. Sets `VAR_NAME` to `BINARY_PATH` after verifying the toolchain
2+ # binary exists. Stops configuration if the required binary is missing.
3+ #
4+ # @param {string} VAR_NAME Variable name to set.
5+ # @param {string} BINARY_PATH Path to the cmake toolchain binary.
6+ function (set_toolchian_binary_var VAR_NAME BINARY_PATH)
7+ if (NOT EXISTS "${BINARY_PATH} " )
8+ message (FATAL_ERROR "Required cmake toolchain binary not found: ${BINARY_PATH} " )
9+ endif ()
10+ set (${VAR_NAME} "${BINARY_PATH} " PARENT_SCOPE)
11+ endfunction ()
12+
113message (STATUS "Setting up LLVM v15 toolchain..." )
214
315execute_process (
@@ -15,7 +27,7 @@ if(NOT 0 EQUAL BREW_RESULT)
1527 )
1628endif ()
1729
18- set (CMAKE_C_COMPILER "${LLVM_TOOLCHAIN_PREFIX} /bin/clang" )
19- set (CMAKE_CXX_COMPILER "${LLVM_TOOLCHAIN_PREFIX} /bin/clang++" )
20- set (CMAKE_AR "${LLVM_TOOLCHAIN_PREFIX} /bin/llvm-ar" )
21- set (CMAKE_RANLIB "${LLVM_TOOLCHAIN_PREFIX} /bin/llvm-ranlib" )
30+ set_toolchian_binary_var (CMAKE_C_COMPILER "${LLVM_TOOLCHAIN_PREFIX} /bin/clang" )
31+ set_toolchian_binary_var (CMAKE_CXX_COMPILER "${LLVM_TOOLCHAIN_PREFIX} /bin/clang++" )
32+ set_toolchian_binary_var (CMAKE_AR "${LLVM_TOOLCHAIN_PREFIX} /bin/llvm-ar" )
33+ set_toolchian_binary_var (CMAKE_RANLIB "${LLVM_TOOLCHAIN_PREFIX} /bin/llvm-ranlib" )
Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ function(validate_compiler_versions)
4343 message (
4444 FATAL_ERROR
4545 "${CMAKE_CXX_COMPILER_ID} version ${CMAKE_CXX_COMPILER_VERSION} is too low. Must be at \
46- least ${CXX_COMPILER_MIN_VERSION} ."
46+ least ${CXX_COMPILER_MIN_VERSION} ."
4747 )
4848 endif ()
4949endfunction ()
You can’t perform that action at this time.
0 commit comments