diff options
author | Robert Maynard <rmaynard@nvidia.com> | 2022-06-27 18:42:46 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2022-07-01 12:04:54 (GMT) |
commit | cd324110d2ecef8dd955f7089382d15708cad98d (patch) | |
tree | 60dc7e97e0752690ac8bee19bb92842356e2f138 /Tests/RunCMake/CompileWarningAsError | |
parent | 2e9ac1d2726c4f260efd6b455242ec5d65391e12 (diff) | |
download | CMake-cd324110d2ecef8dd955f7089382d15708cad98d.zip CMake-cd324110d2ecef8dd955f7089382d15708cad98d.tar.gz CMake-cd324110d2ecef8dd955f7089382d15708cad98d.tar.bz2 |
CUDA: NVCC support for COMPILE_WARNING_AS_ERROR target property
Diffstat (limited to 'Tests/RunCMake/CompileWarningAsError')
8 files changed, 16 insertions, 0 deletions
diff --git a/Tests/RunCMake/CompileWarningAsError/RunCMakeTest.cmake b/Tests/RunCMake/CompileWarningAsError/RunCMakeTest.cmake index b068c18..392c921 100644 --- a/Tests/RunCMake/CompileWarningAsError/RunCMakeTest.cmake +++ b/Tests/RunCMake/CompileWarningAsError/RunCMakeTest.cmake @@ -10,6 +10,10 @@ endfunction() set(langs C CXX) set(exts c cxx) +if(CMake_TEST_CUDA) + list(APPEND langs CUDA) + list(APPEND exts cu) +endif() foreach(lang ext IN ZIP_LISTS langs exts) run_compile_warn(WerrorOn ${lang} ${ext}) diff --git a/Tests/RunCMake/CompileWarningAsError/WarningAsErrorOptions.cmake b/Tests/RunCMake/CompileWarningAsError/WarningAsErrorOptions.cmake index b5b981c..590c8a4 100644 --- a/Tests/RunCMake/CompileWarningAsError/WarningAsErrorOptions.cmake +++ b/Tests/RunCMake/CompileWarningAsError/WarningAsErrorOptions.cmake @@ -6,6 +6,13 @@ macro(get_warning_options warning_options lang) elseif (CMAKE_${lang}_COMPILER_ID STREQUAL "MSVC" OR (CMAKE_${lang}_COMPILER_ID STREQUAL "Intel" AND CMAKE_${lang}_SIMULATE_ID MATCHES "MSVC")) set(${warning_options} "-W4") + elseif (CMAKE_${lang}_COMPILER_ID STREQUAL "NVIDIA" + AND CMAKE_${lang}_COMPILER_VERSION VERSION_GREATER_EQUAL 10.2.89) + if(CMAKE_${lang}_SIMULATE_ID MATCHES "MSVC") + set(${warning_options} "-Xcompiler=-W4") + else() + set(${warning_options} "-Xcompiler=-Wall") + endif() elseif (CMAKE_${lang}_COMPILER_ID STREQUAL "Intel") set(${warning_options} "-w3") elseif (CMAKE_${lang}_COMPILER_ID STREQUAL "XL") diff --git a/Tests/RunCMake/CompileWarningAsError/WerrorOff_CUDA.cmake b/Tests/RunCMake/CompileWarningAsError/WerrorOff_CUDA.cmake new file mode 100644 index 0000000..35c02aa --- /dev/null +++ b/Tests/RunCMake/CompileWarningAsError/WerrorOff_CUDA.cmake @@ -0,0 +1 @@ +include(WerrorOff.cmake) diff --git a/Tests/RunCMake/CompileWarningAsError/WerrorOnIgnore_CUDA.cmake b/Tests/RunCMake/CompileWarningAsError/WerrorOnIgnore_CUDA.cmake new file mode 100644 index 0000000..ebb9e0e --- /dev/null +++ b/Tests/RunCMake/CompileWarningAsError/WerrorOnIgnore_CUDA.cmake @@ -0,0 +1 @@ +include(WerrorOnIgnore.cmake) diff --git a/Tests/RunCMake/CompileWarningAsError/WerrorOn_CUDA-Build-result.txt b/Tests/RunCMake/CompileWarningAsError/WerrorOn_CUDA-Build-result.txt new file mode 100644 index 0000000..d197c91 --- /dev/null +++ b/Tests/RunCMake/CompileWarningAsError/WerrorOn_CUDA-Build-result.txt @@ -0,0 +1 @@ +[^0] diff --git a/Tests/RunCMake/CompileWarningAsError/WerrorOn_CUDA.cmake b/Tests/RunCMake/CompileWarningAsError/WerrorOn_CUDA.cmake new file mode 100644 index 0000000..a00edb8 --- /dev/null +++ b/Tests/RunCMake/CompileWarningAsError/WerrorOn_CUDA.cmake @@ -0,0 +1 @@ +include(WerrorOn.cmake) diff --git a/Tests/RunCMake/CompileWarningAsError/err.cu b/Tests/RunCMake/CompileWarningAsError/err.cu new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/CompileWarningAsError/err.cu diff --git a/Tests/RunCMake/CompileWarningAsError/warn.cu b/Tests/RunCMake/CompileWarningAsError/warn.cu new file mode 100644 index 0000000..22b8db8 --- /dev/null +++ b/Tests/RunCMake/CompileWarningAsError/warn.cu @@ -0,0 +1 @@ +#include "warn.c" |