r/cpp • • Aug 03 '26

Common Problems I see with Public Libraries Build Scripts

Hi, I'm an early user of Common Package Specification and C++ modules. I package and port libraries for my own use frequently.

I want to talk about issues I see constantly.

- Having specific options for sanitizers, exceptions etc, this is a toolchain problem, if I wanna build your library with sanitizers I can just add the flags to my cmake toolchain file same as allocators.

- Not separating build options to a separate file, meson already does this, it ain't that hard to do in cmake, just cache variables in a separate file at project dir which you include before subdirs

- Making tests separate cmake projects rather than just executables, just why?

- Vendoring dependencies, copy pasting files from other projects rather than just consuming these external libs via packages.

- Using unnecessary helper functions that really makes the cmake script unreadable. Build scripts don't need to be over engineered, they are just basic scripts in which you define very basic information.

I could go on but I'm tired.

26 Upvotes

52 comments sorted by

View all comments

Show parent comment

8

u/trad_emark Aug 04 '26

how else do i build the code in github CI if i dont clone the source?

-8

u/TheRavagerSw Aug 04 '26

I'm talking about local builds, I recommend not building your library via CI, you can just run tests on it instead. But again I'm the minority here.

But yeah you can't build on CI if you don't clone all the time