我有一个 CMake 文件,用于在 Windows 上构建一些 CUDA (NVCC/MSVC)。我正在尝试使用以下命令将 MSVC 警告级别设置为/W4:
add_compile_options("$<$<COMPILE_LANGUAGE:CUDA>:--compiler-options=/W4>")
Run Code Online (Sandbox Code Playgroud)
使用 CMake 3.9 构建时,我收到以下警告:
(CudaBuildCore target) ->
cl : Command line warning D9025: overriding '/W4' with '/W3'
Run Code Online (Sandbox Code Playgroud)
在 CMake 3.15 中,该策略已更改为不会/W3在 CUDA 标志中自动设置,但在该版本中我得到:
(CudaBuildCore target) ->
cl : Command line warning D9025: overriding '/W4' with '/W1'
Run Code Online (Sandbox Code Playgroud)
如果我执行构建步骤,--verbose我会在 3.9 中看到以下内容:
"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin\nvcc.exe" -gencode=arch=compute_30,code=\"compute_30,compute_30\" --use-local-env -ccbin "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64" -x cu -IC:\Users\eddi\Documents\temp\thur\sw\include -IC:\Users\eddi\Documents\temp\thur\sw\shared\common\include -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include" --keep-dir x64\Debug -maxrregcount=0 …Run Code Online (Sandbox Code Playgroud)