cmake: scope /utf-8 to C and C++ so nvcc does not treat it as an input file

This commit is contained in:
Pascal
2026-05-17 14:41:39 +02:00
parent 8e1df7329a
commit 55b7234d21
+5 -2
View File
@@ -22,10 +22,13 @@ find_package(Threads REQUIRED)
# Suppress MSVC fopen/sprintf deprecation warnings, force UTF-8 source and # Suppress MSVC fopen/sprintf deprecation warnings, force UTF-8 source and
# execution charsets so non-ASCII string literals (CJK language names, # execution charsets so non-ASCII string literals (CJK language names,
# punctuation tables in BPE and prompt builder) survive the compile # punctuation tables in BPE and prompt builder) survive the compile
# without a BOM. # without a BOM. /utf-8 is restricted to C and C++ since nvcc treats a
# bare /utf-8 as an input filename and aborts with "A single input file
# is required". CUDA sources do not carry CJK literals so they do not
# need this flag.
if(MSVC) if(MSVC)
add_compile_definitions(_CRT_SECURE_NO_WARNINGS) add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
add_compile_options(/utf-8) add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/utf-8>)
endif() endif()
# Put executables and backend .so in the same directory (build root). # Put executables and backend .so in the same directory (build root).