TGViewer
C++ - Reddit C++ - Reddit @r_cpp · 229 subscribers
Post #24765 19
I think build systems shouldn't have variables that affect flags

Having cmake, meson etc parse your flags and options is more cumbersome than it worth, and is usually a source of bugs.

I think the correct approach for any new toolchain should be to have a separate toolchain file for everything you want to do. A toockhain file should only define binaries and flags.

want to have lto? use the toolchain with -flto

want to have PIC? use the toolchain that has -fPIC

Having cmake take a variable like -DINTERPROCEDURAL_OPTIMIZATION to have a lot build with the same toolchain just leads to bugs. Often some projects simply ignore your flags anyway

Also, flags change as compiler version changes. So you have to constantly maintain the build system.

\----

I'm honestly tired of projects ignoring my flags, for example llvm compiler RT ignoring add_linkoptions, or cmke ignoring add_compile_options for building std module. I had to use old cxx init variables.

I think this was a bad idea from the beginning, A modern build system should just have a nice DSL, and take flags and executables and that's it. It shouldn't deal with other build systems, it shouldn't act as a package manager.

It should be a binary, not a python package so the scripting should be built in.

Anyway, this was my rant/discussion or whatever.

https://redd.it/1qz55an
@r_cpp
Reddit From the cpp community on Reddit Explore this post and more from the cpp community
More from @r_cpp
  1. Oct 7, 2026Escaping `CreateProcess()` arguments on Windows https://holyblackcat.github.io/blog/2026/0…
  2. Oct 7, 2026flat_map internals https://quantdev.blog/posts/flat-map-internals/index.html https://redd.…
  3. Oct 7, 2026New C++ Conference Videos Released This Month - September 2026 C++Now 2026-08-31 - 2026-09…
  4. Oct 7, 2026Jean Frantz René: C++ Memory safety for safety-critical and non-safety critical applicatio…
  5. Oct 7, 2026Full Meeting C++ 2026 program released https://meetingcpp.com/mcpp/schedule/#2026 https://…
  6. Oct 7, 2026Qt moc now can handle basic C++ modules (Qt 6.12) https://codereview.qt-project.org/c/qt/q…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →