From 509b4112fa89a7314485a2aad1cb273a494c596f Mon Sep 17 00:00:00 2001 From: Cebtenzzre Date: Sun, 1 Oct 2023 00:12:03 -0400 Subject: [PATCH] cmake : fix MSVC build --- CMakeLists.txt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dc9dedcaf..65c7dbf06 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -453,8 +453,16 @@ if (LLAMA_ALL_WARNINGS) endif() +if (NOT MSVC) + set(cuda_flags -Wno-pedantic) +endif() +set(cuda_flags ${cxx_flags} -use_fast_math ${cuda_flags}) + list(JOIN host_cxx_flags " " cuda_host_flags) # pass host compiler flags as a single argument -set(cuda_flags ${cxx_flags} -use_fast_math -Wno-pedantic ${cuda_flags} -Xcompiler ${cuda_host_flags}) +if (NOT cuda_host_flags STREQUAL "") + set(cuda_flags ${cuda_flags} -Xcompiler ${cuda_host_flags}) +endif() + add_compile_options("$<$:${cuda_flags}>") if (WIN32)