[llvm-dev] wasteful cmake defaults

Michael Kruse via llvm-dev llvm-dev at lists.llvm.org
Wed Nov 18 10:12:11 PST 2020


Am Mi., 18. Nov. 2020 um 05:48 Uhr schrieb Luke Drummond
<luke.drummond at codeplay.com>:
> > What is such a build useful for the average user? If changing the
> > default, I think that CMAKE_BUILD_TYPE=Release is what most
> > non-developer users want.
>
> You're probably right, in that if I just want to build e.g. clang from
> source because my distro package manager contains an old version and I'm
> not interested in hacking on it myself, then a release build makes
> sense. However, I think this is a violation of expectations in that this
> is overriding a *cmake* variable. It takes control away from the user.
> cmake probably has something to answer for here, because there's not an
> explicit "empty" buildtype like e.g. meson's `--buildtype plain`, but
> only the absense of a value.

Unfortunately CMAKE_* variables is commonplace. Doesn't mean it is
good and should avoid it.
In this case, however, it is not overriding a user setting, but
provide a default one when the user did not specify one explicitly. In
this specific case, IMHO cmake's default-empty CMAKE_BUILD_TYPE is a
common beginner's trap, serves no use case, and is even recommended by
KitWare itself:
https://blog.kitware.com/cmake-and-the-default-build-type/

Michael


More information about the llvm-dev mailing list