aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRui Ueyama <[email protected]>2023-08-16 13:54:45 +0900
committerJack O'Connor <[email protected]>2023-11-05 09:08:13 -0800
commite1f851d461324793c1261609f91288d3b868cb93 (patch)
tree1291f12aa6658b4a4bfacd7264543c9247135fd6
parent3465fe455e6cfd98d94f6d5fe1de9c4e2d566b33 (diff)
Fix Windows build with clang-cl
clang-cl is LLVM's MSVC-compatible compiler frontend for Windows ABI. If clang-cl is in use, `CMAKE_C_COMPILER_ID` is `Clang` even though it doesn't take Unix-like command line options but MSVC-like options. `if(MSVC)` is the correct predicate to check if we should pass MSVC-ish command line options.
-rw-r--r--c/CMakeLists.txt4
1 files changed, 2 insertions, 2 deletions
diff --git a/c/CMakeLists.txt b/c/CMakeLists.txt
index cbeb555..34874b3 100644
--- a/c/CMakeLists.txt
+++ b/c/CMakeLists.txt
@@ -14,7 +14,7 @@ set(BLAKE3_AMD64_NAMES amd64 AMD64 x86_64)
set(BLAKE3_X86_NAMES i686 x86 X86)
set(BLAKE3_ARMv8_NAMES aarch64 AArch64 arm64 ARM64 armv8 armv8a)
# default SIMD compiler flag configuration (can be overriden by toolchains or CLI)
-if(CMAKE_C_COMPILER_ID STREQUAL "MSVC")
+if(MSVC)
set(BLAKE3_CFLAGS_SSE2 "/arch:SSE2" CACHE STRING "the compiler flags to enable SSE2")
# MSVC has no dedicated sse4.1 flag (see https://learn.microsoft.com/en-us/cpp/build/reference/arch-x86?view=msvc-170)
set(BLAKE3_CFLAGS_SSE4.1 "/arch:AVX" CACHE STRING "the compiler flags to enable SSE4.1")
@@ -77,7 +77,7 @@ endmacro()
if(CMAKE_SYSTEM_PROCESSOR IN_LIST BLAKE3_AMD64_NAMES OR BLAKE3_USE_AMD64_ASM)
set(BLAKE3_SIMD_AMD64_ASM ON)
- if(CMAKE_C_COMPILER_ID STREQUAL "MSVC")
+ if(MSVC)
enable_language(ASM_MASM)
target_sources(blake3 PRIVATE
blake3_avx2_x86-64_windows_msvc.asm