From f3d7a1501003ab9582b94639b06d19feed107f2f Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 25 Mar 2020 15:25:39 -0400 Subject: VS: Fix ClangCL toolset compiler path detection Prior to commit 3c125c6de0 (VS: Support Visual Studio Clang Toolkit identification, 2019-12-03, v3.17.0-rc1~341^2) using `-T ClangCL` would work but `CMAKE_{C,CXX}_COMPILER` would be detected as `cl.exe` even though `clang-cl.exe` is the actual compiler. That commit attempted to fix the detection by using `$(ClangClExecutable)` as we do for LLVM-distributed toolsets, but that is not actually defined. Instead, look for `$(CLToolExe)` in the `PATH`. Fixes: #20504 --- Modules/CMakeDetermineCompilerId.cmake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index d125791..66676b1 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -246,8 +246,10 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS} set(id_platform ${CMAKE_VS_PLATFORM_NAME}) set(id_lang "${lang}") set(id_PostBuildEvent_Command "") - if(CMAKE_VS_PLATFORM_TOOLSET MATCHES "^([Ll][Ll][Vv][Mm](_v[0-9]+(_xp)?)?|[Cc][Ll][Aa][Nn][Gg][Cc][Ll])$") + if(CMAKE_VS_PLATFORM_TOOLSET MATCHES "^[Ll][Ll][Vv][Mm](_v[0-9]+(_xp)?)?$") set(id_cl_var "ClangClExecutable") + elseif(CMAKE_VS_PLATFORM_TOOLSET MATCHES "^[Cc][Ll][Aa][Nn][Gg][Cc][Ll]$") + set(id_cl "$(CLToolExe)") elseif(CMAKE_VS_PLATFORM_TOOLSET MATCHES "v[0-9]+_clang_.*") set(id_cl clang.exe) else() -- cgit v0.12