
2025-08-18 08:42:07
If you're writing a library, you should really avoid #CMake. CMake is designed to lock you in. As in, once you release a #FreeSoftware project using CMake, you can't switch to another build system with causing real trouble to your users. And if you support multiple build systems, as soon as you start supporting CMake, some of your users are going to start locking everyone else in.
That's because CMake uses a custom package discovery mechanism that's hardly compatible with anything else, and that is so complex that it's very hard to reimplement it with any other build system. So when others start relying on the CMake config files being installed (and they naturally will, since that's how CMake does things), you can't stop installing them without actually breaking stuff. And if you want to preserve them without actually using CMake, well, good luck with that.
And if CMake is one of the options you support, then some of your consumers will accidentally start relying on it anyway. And this will be much worse for everyone, because now their projects won't work for people who build your project with any other build system. Which in turn will force more projects to use CMake anyway. Which in turn will make more people rely on CMake being used…
Use #Meson as the build system, it's clean and not designed to lock you in. Use pkg-config for library data; it's simple and portable.
#OpenSource