@@ -160,6 +160,8 @@ export async function main(args: string[]): Promise<number> {
160
160
return 1
161
161
}
162
162
163
+ let hasLLVM = false // used to unset CPPFLAGS of LLVM when other compilers are used as the main compiler
164
+
163
165
// loop over the tools and run their setup function
164
166
for ( const tool of tools ) {
165
167
// get the version or "true" or undefined for this tool from the options
@@ -187,8 +189,10 @@ export async function main(args: string[]): Promise<number> {
187
189
// get the setup function
188
190
const setupFunction = setups [ tool ]
189
191
192
+ hasLLVM = [ "llvm" , "clangformat" , "clangtidy" ] . includes ( tool )
193
+
190
194
// the tool installation directory (for the functions that ue it)
191
- const setupDir = join ( setupCppDir , [ "llvm" , "clangformat" , "clangtidy" ] . includes ( tool ) ? "llvm" : tool )
195
+ const setupDir = join ( setupCppDir , hasLLVM ? "llvm" : tool )
192
196
193
197
// eslint-disable-next-line no-await-in-loop
194
198
installationInfo = await setupFunction ( getVersion ( tool , version , osVersion ) , setupDir , arch )
@@ -232,6 +236,12 @@ export async function main(args: string[]): Promise<number> {
232
236
case "cygwin" :
233
237
case "msys" : {
234
238
const installationInfo = await setupGcc ( getVersion ( "gcc" , version , osVersion ) , join ( setupCppDir , "gcc" ) , arch )
239
+
240
+ if ( hasLLVM ) {
241
+ // remove the CPPFLAGS of LLVM that include the LLVM headers
242
+ await addEnv ( "CPPFLAGS" , "" )
243
+ }
244
+
235
245
successMessages . push ( getSuccessMessage ( "gcc" , installationInfo ) )
236
246
break
237
247
}
@@ -247,6 +257,12 @@ export async function main(args: string[]): Promise<number> {
247
257
join ( setupCppDir , "msvc" ) ,
248
258
arch
249
259
)
260
+
261
+ if ( hasLLVM ) {
262
+ // remove the CPPFLAGS of LLVM that include the LLVM headers
263
+ await addEnv ( "CPPFLAGS" , "" )
264
+ }
265
+
250
266
successMessages . push ( getSuccessMessage ( "msvc" , installationInfo ) )
251
267
break
252
268
}
0 commit comments