@@ -857,6 +857,21 @@ function Get-PinnedToolchainVersion() {
857857 throw " PinnedVersion must be set"
858858}
859859
860+ function Get-ClangDriverName ([Platform ] $Platform , [string ] $Lang ) {
861+ switch ($Platform ) {
862+ Windows {
863+ " clang-cl.exe"
864+ }
865+ Android {
866+ switch ($Lang ) {
867+ C { " clang.exe" }
868+ ASM { " clang.exe" }
869+ CXX { " clang++.exe" }
870+ }
871+ }
872+ }
873+ }
874+
860875function TryAdd-KeyValue ([hashtable ]$Hashtable , [string ]$Key , [string ]$Value ) {
861876 if (-not $Hashtable.Contains ($Key )) {
862877 $Hashtable.Add ($Key , $Value )
@@ -1038,7 +1053,7 @@ function Build-CMakeProject {
10381053 Append- FlagsDefine $Defines CMAKE_CXX_FLAGS $CXXFlags
10391054 }
10401055 if ($UsePinnedCompilers.Contains (" ASM" ) -Or $UseBuiltCompilers.Contains (" ASM" )) {
1041- $Driver = if ( $Platform -eq " Windows " ) { " clang-cl.exe " } else { " clang.exe " }
1056+ $Driver = ( Get-ClangDriverName $Platform - Lang " ASM " )
10421057 if ($UseBuiltCompilers.Contains (" ASM" )) {
10431058 TryAdd- KeyValue $Defines CMAKE_ASM_COMPILER ([IO.Path ]::Combine($CompilersBinaryCache , " bin" , $Driver ))
10441059 } else {
@@ -1050,7 +1065,7 @@ function Build-CMakeProject {
10501065 }
10511066 }
10521067 if ($UsePinnedCompilers.Contains (" C" ) -Or $UseBuiltCompilers.Contains (" C" )) {
1053- $Driver = if ( $Platform -eq " Windows " ) { " clang-cl.exe " } else { " clang.exe " }
1068+ $Driver = ( Get-ClangDriverName $Platform - Lang " C " )
10541069 if ($UseBuiltCompilers.Contains (" C" )) {
10551070 TryAdd- KeyValue $Defines CMAKE_C_COMPILER ([IO.Path ]::Combine($CompilersBinaryCache , " bin" , $Driver ))
10561071 } else {
@@ -1069,7 +1084,7 @@ function Build-CMakeProject {
10691084 Append- FlagsDefine $Defines CMAKE_C_FLAGS $CFlags
10701085 }
10711086 if ($UsePinnedCompilers.Contains (" CXX" ) -Or $UseBuiltCompilers.Contains (" CXX" )) {
1072- $Driver = if ( $Platform -eq " Windows " ) { " clang-cl.exe " } else { " clang++.exe " }
1087+ $Driver = ( Get-ClangDriverName $Platform - Lang " CXX " )
10731088 if ($UseBuiltCompilers.Contains (" CXX" )) {
10741089 TryAdd- KeyValue $Defines CMAKE_CXX_COMPILER ([IO.Path ]::Combine($CompilersBinaryCache , " bin" , $Driver ))
10751090 } else {
0 commit comments