From 586c2ab4f1fd758956c6d4f149c6f5628de7ebeb Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 29 Sep 2022 08:04:05 -0400 Subject: Tests: Test more CMakeTest*Compiler.cmake fallbacks Extend the test added by commit f891a75d5c (Tests: Test CMakeTest*Compiler.cmake fallbacks, 2022-09-27) to cover more languages. --- Tests/RunCMake/CMakeLists.txt | 9 +++++++++ Tests/RunCMake/CompilerTest/CUDA-stdout.txt | 2 ++ Tests/RunCMake/CompilerTest/CUDA.cmake | 3 +++ Tests/RunCMake/CompilerTest/Fortran-stdout.txt | 2 ++ Tests/RunCMake/CompilerTest/Fortran.cmake | 3 +++ Tests/RunCMake/CompilerTest/HIP-stdout.txt | 2 ++ Tests/RunCMake/CompilerTest/HIP.cmake | 3 +++ Tests/RunCMake/CompilerTest/ISPC-stdout.txt | 3 +++ Tests/RunCMake/CompilerTest/ISPC.cmake | 3 +++ Tests/RunCMake/CompilerTest/RunCMakeTest.cmake | 16 ++++++++++++++++ 10 files changed, 46 insertions(+) create mode 100644 Tests/RunCMake/CompilerTest/CUDA-stdout.txt create mode 100644 Tests/RunCMake/CompilerTest/CUDA.cmake create mode 100644 Tests/RunCMake/CompilerTest/Fortran-stdout.txt create mode 100644 Tests/RunCMake/CompilerTest/Fortran.cmake create mode 100644 Tests/RunCMake/CompilerTest/HIP-stdout.txt create mode 100644 Tests/RunCMake/CompilerTest/HIP.cmake create mode 100644 Tests/RunCMake/CompilerTest/ISPC-stdout.txt create mode 100644 Tests/RunCMake/CompilerTest/ISPC.cmake diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 428bbff..6c5ab7f 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -298,7 +298,16 @@ add_RunCMake_test(CompilerNotFound) if (APPLE AND CMAKE_C_COMPILER_ID MATCHES "Clang|GNU") list(APPEND CompilerTest_ARGS -DCMake_TEST_OBJC=1) endif() +if(CMAKE_Fortran_COMPILER) + list(APPEND CompilerTest_ARGS -DCMake_TEST_Fortran=1) +endif() +foreach(lang IN ITEMS CUDA HIP ISPC) + if(CMake_TEST_${lang}) + list(APPEND CompilerTest_ARGS -DCMake_TEST_${lang}=1) + endif() +endforeach() add_RunCMake_test(CompilerTest) +set_property(TEST RunCMake.CompilerTest APPEND PROPERTY LABELS "CUDA" "HIP" "ISPC") add_RunCMake_test(Configure -DMSVC_IDE=${MSVC_IDE}) add_RunCMake_test(DisallowedCommands) if("${CMAKE_GENERATOR}" MATCHES "Unix Makefiles|Ninja") diff --git a/Tests/RunCMake/CompilerTest/CUDA-stdout.txt b/Tests/RunCMake/CompilerTest/CUDA-stdout.txt new file mode 100644 index 0000000..00d35df --- /dev/null +++ b/Tests/RunCMake/CompilerTest/CUDA-stdout.txt @@ -0,0 +1,2 @@ +-- Check for working CUDA compiler: [^ +]* - works diff --git a/Tests/RunCMake/CompilerTest/CUDA.cmake b/Tests/RunCMake/CompilerTest/CUDA.cmake new file mode 100644 index 0000000..e8c19a0 --- /dev/null +++ b/Tests/RunCMake/CompilerTest/CUDA.cmake @@ -0,0 +1,3 @@ +# Pretend the ABI check failed in order to force the fall-back test to run. +set(CMAKE_CUDA_ABI_COMPILED FALSE) +enable_language(CUDA) diff --git a/Tests/RunCMake/CompilerTest/Fortran-stdout.txt b/Tests/RunCMake/CompilerTest/Fortran-stdout.txt new file mode 100644 index 0000000..d871fea --- /dev/null +++ b/Tests/RunCMake/CompilerTest/Fortran-stdout.txt @@ -0,0 +1,2 @@ +-- Check for working Fortran compiler: [^ +]* - works diff --git a/Tests/RunCMake/CompilerTest/Fortran.cmake b/Tests/RunCMake/CompilerTest/Fortran.cmake new file mode 100644 index 0000000..8c83bd7 --- /dev/null +++ b/Tests/RunCMake/CompilerTest/Fortran.cmake @@ -0,0 +1,3 @@ +# Pretend the ABI check failed in order to force the fall-back test to run. +set(CMAKE_Fortran_ABI_COMPILED FALSE) +enable_language(Fortran) diff --git a/Tests/RunCMake/CompilerTest/HIP-stdout.txt b/Tests/RunCMake/CompilerTest/HIP-stdout.txt new file mode 100644 index 0000000..8b3baa7 --- /dev/null +++ b/Tests/RunCMake/CompilerTest/HIP-stdout.txt @@ -0,0 +1,2 @@ +-- Check for working HIP compiler: [^ +]* - works diff --git a/Tests/RunCMake/CompilerTest/HIP.cmake b/Tests/RunCMake/CompilerTest/HIP.cmake new file mode 100644 index 0000000..e56b77a --- /dev/null +++ b/Tests/RunCMake/CompilerTest/HIP.cmake @@ -0,0 +1,3 @@ +# Pretend the ABI check failed in order to force the fall-back test to run. +set(CMAKE_HIP_ABI_COMPILED FALSE) +enable_language(HIP) diff --git a/Tests/RunCMake/CompilerTest/ISPC-stdout.txt b/Tests/RunCMake/CompilerTest/ISPC-stdout.txt new file mode 100644 index 0000000..7e45c91 --- /dev/null +++ b/Tests/RunCMake/CompilerTest/ISPC-stdout.txt @@ -0,0 +1,3 @@ +-- The ISPC compiler identification is [^ +]* +-- Configuring done diff --git a/Tests/RunCMake/CompilerTest/ISPC.cmake b/Tests/RunCMake/CompilerTest/ISPC.cmake new file mode 100644 index 0000000..3ce7b28 --- /dev/null +++ b/Tests/RunCMake/CompilerTest/ISPC.cmake @@ -0,0 +1,3 @@ +# Pretend the ABI check failed in order to force the fall-back test to run. +set(CMAKE_ISPC_ABI_COMPILED FALSE) +enable_language(ISPC) diff --git a/Tests/RunCMake/CompilerTest/RunCMakeTest.cmake b/Tests/RunCMake/CompilerTest/RunCMakeTest.cmake index 995296a..2dd9c7f 100644 --- a/Tests/RunCMake/CompilerTest/RunCMakeTest.cmake +++ b/Tests/RunCMake/CompilerTest/RunCMakeTest.cmake @@ -3,6 +3,22 @@ include(RunCMake) run_cmake(C) run_cmake(CXX) +if(CMake_TEST_CUDA) + run_cmake(CUDA) +endif() + +if(CMake_TEST_Fortran) + run_cmake(Fortran) +endif() + +if(CMake_TEST_HIP) + run_cmake(HIP) +endif() + +if(CMake_TEST_ISPC) + run_cmake(ISPC) +endif() + if(CMake_TEST_OBJC) run_cmake(OBJC) run_cmake(OBJCXX) -- cgit v0.12