Reputation: 59
I am using Meson for building C++
project and need to set compiler priority to clang
instead of default gcc
when it avaible. How to do that in meson.build
file? Is it possible without additional meson setup
args?
P.S. if this not possible, how to do the same with Cmake
?
Tried to use meson setup --native-file nativefile.ini ./build
command to set clang
, but if system does not have clang
it fails (and also reqiures to manually pass native file to meson). Same with CXX=clang++ meson setup ./build
, that is manual, I need autodetect. How to just use meson setup ./build
for this to make it system-independent?
Upvotes: 0
Views: 260
Reputation: 399
Presently Meson is not capable of specifying the default compilers (at least in meson.build
). There is an issue for it here. Perhaps one day they will add such a feature.
Edit, while old (2013), I think CMake has the same limitation:
By default, [cmake] searches for a list of known compiler names:
cc, gcc, cl, bcc, xlc, clang
In that order, in PATH.
If you set the CC (or CXX respectively) environment variable, it will use this compiler.
Upvotes: 0