@@ -160,6 +160,8 @@ export async function main(args: string[]): Promise<number> {
160160 return 1
161161 }
162162
163+ let hasLLVM = false // used to unset CPPFLAGS of LLVM when other compilers are used as the main compiler
164+
163165 // loop over the tools and run their setup function
164166 for ( const tool of tools ) {
165167 // 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> {
187189 // get the setup function
188190 const setupFunction = setups [ tool ]
189191
192+ hasLLVM = [ "llvm" , "clangformat" , "clangtidy" ] . includes ( tool )
193+
190194 // 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 )
192196
193197 // eslint-disable-next-line no-await-in-loop
194198 installationInfo = await setupFunction ( getVersion ( tool , version , osVersion ) , setupDir , arch )
@@ -232,6 +236,12 @@ export async function main(args: string[]): Promise<number> {
232236 case "cygwin" :
233237 case "msys" : {
234238 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+
235245 successMessages . push ( getSuccessMessage ( "gcc" , installationInfo ) )
236246 break
237247 }
@@ -247,6 +257,12 @@ export async function main(args: string[]): Promise<number> {
247257 join ( setupCppDir , "msvc" ) ,
248258 arch
249259 )
260+
261+ if ( hasLLVM ) {
262+ // remove the CPPFLAGS of LLVM that include the LLVM headers
263+ await addEnv ( "CPPFLAGS" , "" )
264+ }
265+
250266 successMessages . push ( getSuccessMessage ( "msvc" , installationInfo ) )
251267 break
252268 }
0 commit comments