| 1 |
include(RunCMake) |
| 2 |
|
| 3 |
function(run_compile_warn test lang extension) |
| 4 |
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${test}_${lang}-build) |
| 5 |
set(RunCMake_TEST_OUTPUT_MERGE 1) |
| 6 |
run_cmake_with_options(${test}_${lang} "-DLANGUAGE=${lang}" "-DEXTENSION=${extension}" ${ARGN}) |
| 7 |
set(RunCMake_TEST_NO_CLEAN 1) |
| 8 |
if(ARGN MATCHES "--compile-no-warning-as-error") |
| 9 |
# Cause the build system to re-run CMake to verify that this option is preserved. |
| 10 |
run_cmake_command(${test}_${lang}-Touch ${CMAKE_COMMAND} -E touch_nocreate CMakeCache.txt) |
| 11 |
endif() |
| 12 |
run_cmake_command(${test}_${lang}-Build ${CMAKE_COMMAND} --build . ${verbose_args}) |
| 13 |
endfunction() |
| 14 |
|
| 15 |
set(langs C CXX) |
| 16 |
set(exts c cxx) |
| 17 |
if(CMake_TEST_CUDA) |
| 18 |
list(APPEND langs CUDA) |
| 19 |
list(APPEND exts cu) |
| 20 |
endif() |
| 21 |
|
| 22 |
if(CMAKE_Swift_COMPILER_VERSION AND CMAKE_Swift_COMPILER_VERSION VERSION_LESS 3.0) |
| 23 |
set(CMake_TEST_Swift 0) |
| 24 |
endif() |
| 25 |
|
| 26 |
if(CMake_TEST_Swift) |
| 27 |
list(APPEND langs Swift) |
| 28 |
list(APPEND exts swift) |
| 29 |
endif() |
| 30 |
|
| 31 |
foreach(lang ext IN ZIP_LISTS langs exts) |
| 32 |
run_compile_warn(WerrorOn ${lang} ${ext}) |
| 33 |
run_compile_warn(WerrorOff ${lang} ${ext}) |
| 34 |
run_compile_warn(WerrorOnIgnore ${lang} ${ext} "--compile-no-warning-as-error") |
| 35 |
endforeach() |