From 6c965db903a5defe4f5d7a0ed68b4f8338380b4c Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 25 Jul 2024 12:40:25 -0700 Subject: [PATCH] Add compiler guard rails for sysroot --- cmake/wasi-sdk-sysroot.cmake | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cmake/wasi-sdk-sysroot.cmake b/cmake/wasi-sdk-sysroot.cmake index 6bed7d37d..394b5628c 100644 --- a/cmake/wasi-sdk-sysroot.cmake +++ b/cmake/wasi-sdk-sysroot.cmake @@ -5,6 +5,16 @@ if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE RelWithDebInfo) endif() +if(NOT CMAKE_C_COMPILER_ID MATCHES Clang) + message(FATAL_ERROR "C compiler ${CMAKE_C_COMPILER} is not `Clang`, it is ${CMAKE_C_COMPILER_ID}") +endif() + +set(minimum_clang_required 18.0.0) + +if(CMAKE_C_COMPILER_VERSION VERSION_LESS ${minimum_clang_required}) + message(FATAL_ERROR "compiler version ${CMAKE_C_COMPILER_VERSION} is less than the required version ${minimum_clang_required}") +endif() + find_program(MAKE make REQUIRED) option(WASI_SDK_DEBUG_PREFIX_MAP "Pass `-fdebug-prefix-map` for built artifacts" ON)