5 ms·
People love ceremony. All the source files are written in lists in cmake files. [...] I love writing C because I do none of that overhead. The files to compile
by iainmerrick 3y ago
People love ceremony. All the source files are written in lists in cmake files. [...] I love writing C because I do none of that overhead. The files to compile are whatever is on disk.
I couldn't agree more. I can't stand build tools that don't take globs! I shouldn't need to list the same thing in multiple places just to make it work. Almost all the time, the files on disk should be the only list needed.
- ndiddy 3y agoThe reason why people write all the source files in a list in a cmake file is that it means that when one developer adds a new file, everyone else's build system automatically regenerates the next time they try to build the project. When you use globs (which cmake does support), it means that the CMakeLists.txt file doesn't get modified when adding a new file, so the cmake generated makefiles/ninjafiles/whatever have no way of knowing that the build was modified. Instead of having the build system regenerate and then the build go through, they get a linker error and have to manually run "cmake -B build" or whatever to fix it.
- Filligree 3y agoSomehow this isn't a problem with Cargo.toml, however. What's cmake missing?
- humanrebar 3y agoCMake can detect when new source files are added and rerun itself. You need to know how to spell that option when globbing though.
- ndiddy 3y agoFrom the cmake documentation: > The CONFIGURE_DEPENDS flag may not work reliably on all generators, or if a new generator is added in the future that cannot support it, projects using it will be stuck. Even if CONFIGURE_DEPENDS works reliably, there is still a cost to perform the check on every rebuild.
- xboxnolifes 3y agoIs this much of a problem if you just assume the mentality of having to run cmake every time you pull code?
- humanrebar 3y agoCMake supports globs. It just has notes in the reference docs about why that can lead to slower build times or even incorrect builds (like undetected new files) in some cases.