aminya / setup-cpp

Install all the tools required for building and testing C++/C projects.
Apache License 2.0
185 stars 27 forks source link

fix: use higher priority when installing llvm alternatives #223

Closed tchaikov closed 7 months ago

tchaikov commented 7 months ago

before this change, gcc and g++ are installed using updateAptAlternatives() with the same priority of 40 when they are installed along with ld and libstdc++ as the dependencies of clang and llvm. but both gcc and clang are installed using the same priority of 40 on ubuntu, and the same applies to g++ and clang++. this renders it impossible to use the default compilers of cc and cxx when clang/llvm is installed using setup-cpp on an ubuntu host, as gcc is always prefered over clang by the update-alternatives, as their priorities are identical.

in this change, the "priority" parameter is added to the setupGcc(), so that we can specify a different priority when installing llvm. strictly speaking, this is not necessary. as we can just use a higher priority when calling updateAptAlternatives() in llvm/llvm.ts. but by making it more explicit, we can ensure that we always prefer llvm over gcc when installing llvm.

aminya commented 7 months ago

Thanks for the contribution