summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2024-01-31 19:08:32 (GMT)
committerBrad King <brad.king@kitware.com>2024-01-31 19:42:34 (GMT)
commit899c8d7b21591bdada171dcab41db0aa0cf6b4da (patch)
tree44c4898def1cf7c78275c38a3921ba5be3214ec6
parent16b1f0c3e99023316b12fdabd1980a18b738d942 (diff)
downloadCMake-899c8d7b21591bdada171dcab41db0aa0cf6b4da.zip
CMake-899c8d7b21591bdada171dcab41db0aa0cf6b4da.tar.gz
CMake-899c8d7b21591bdada171dcab41db0aa0cf6b4da.tar.bz2
CUDA/Clang: Fail early when mixing clang++ with cl on Windows
In commit 88c740462c (CUDA/Clang: Add support for MSVC ABI on Windows using GNU-like frontend, 2024-01-17) we updated the message for the existing check to mention CUDA, but neglected to update the check itself. Issue: #25648
-rw-r--r--Modules/Platform/Windows-Clang.cmake21
1 files changed, 8 insertions, 13 deletions
diff --git a/Modules/Platform/Windows-Clang.cmake b/Modules/Platform/Windows-Clang.cmake
index db48150..b9e6394 100644
--- a/Modules/Platform/Windows-Clang.cmake
+++ b/Modules/Platform/Windows-Clang.cmake
@@ -167,37 +167,32 @@ macro(__enable_llvm_rc_preprocessing clang_option_prefix extra_pp_flags)
endif()
endmacro()
-macro(__verify_same_language_values variable)
- foreach(lang "C" "CXX" "HIP")
- if(DEFINED CMAKE_${lang}_${variable})
- list(APPEND __LANGUAGE_VALUES_${variable} "${CMAKE_${lang}_${variable}}")
- endif()
+function(__verify_same_language_values variable langs)
+ foreach(lang IN LISTS langs)
+ list(APPEND __LANGUAGE_VALUES_${variable} ${CMAKE_${lang}_${variable}})
endforeach()
list(REMOVE_DUPLICATES __LANGUAGE_VALUES_${variable})
list(LENGTH __LANGUAGE_VALUES_${variable} __NUM_VALUES)
-
if(__NUM_VALUES GREATER 1)
message(FATAL_ERROR ${ARGN})
endif()
- unset(__NUM_VALUES)
- unset(__LANGUAGE_VALUES_${variable})
-endmacro()
+endfunction()
if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC"
OR "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC"
OR "x${CMAKE_CUDA_SIMULATE_ID}" STREQUAL "xMSVC"
OR "x${CMAKE_HIP_SIMULATE_ID}" STREQUAL "xMSVC")
- __verify_same_language_values(COMPILER_ID
+ __verify_same_language_values(COMPILER_ID "C;CXX;HIP"
"The current configuration mixes Clang and MSVC or "
"some other CL compatible compiler tool. This is not supported. "
- "Use either Clang or MSVC as the compiler for all of C, C++, CUDA and/or HIP.")
+ "Use either Clang or MSVC as the compiler for all of C, C++, and/or HIP.")
- __verify_same_language_values(COMPILER_FRONTEND_VARIANT
+ __verify_same_language_values(COMPILER_FRONTEND_VARIANT "C;CXX;CUDA;HIP"
"The current configuration uses the Clang compiler "
"tool with mixed frontend variants, both the GNU and in MSVC CL "
"like variants. This is not supported. Use either clang/clang++ "
- "or clang-cl as all C, C++, CUDA and/or HIP compilers.")
+ "or clang-cl as all C, C++, CUDA, and/or HIP compilers.")
if(NOT CMAKE_RC_COMPILER_INIT)
# Check if rc is already in the path