3 ms·
CMake punishes you whenever you choose to do anything which in the configure/build step that is not blindigly obvious, adding friction to all the crazy stunts o
by vnorilo 6y ago
CMake punishes you whenever you choose to do anything which in the configure/build step that is not blindigly obvious, adding friction to all the crazy stunts one might dream up.
This a language an evil genius might come up with while trying to do good.
Of course it sucks when you actually need something nontrivial.
Saying this as a heavy CMake user with a strong love and stronger hate relationship with it.
- colejohnson66 6y agoI tried learning CMake and it seemed so simple at first compared to, say, autotools, or even writing one’s own Makefile. Then when you want to do anything other than a simple project, it gets crazy. It’s like it was initially just an informational file format that had scripting bolted on in a haphazard manner so as not to break anything. Doesn’t CMake not even have a concept of arrays? I remember reading that functions to generate arrays were really just fancy string concatenaters with quote escaping.
- vnorilo 6y agoYes, which leads to beautiful things like `LIST_SEPARATOR` [1]. Lists in CMake are just strings with ';' as item separator. All this is just a gentle slap on the wrist for programming in your build system. Or doing something weird like optimizing a CMake-language JSON parser for performance [2]. 1: https://cmake.org/cmake/help/v3.16/module/ExternalProject.html#index-1-command:externalproject_add_step https://cmake.org/cmake/help/v3.16/module/ExternalProject.ht... 2: https://github.com/sbellus/json-cmake/pull/3 https://github.com/sbellus/json-cmake/pull/3
- MaxBarraclough 6y ago> All this is just a gentle slap on the wrist for programming in your build system That's an awfully polite way of saying Yes, the CMake scripting language is indeed terrible. It's meant to be used for complex package-detection logic. CMake Find modules can run hundreds of lines. It's not unreasonable to expect proper support for arrays, proper functions that can return values, a sane syntax, etc.
- barumi 6y ago> Then when you want to do anything other than a simple project, it gets crazy. I've been using CMake for around a decade and I have to say I never experienced anything remotely similar to what you described. Do you mind sharing a real-world example of something that you struggled with while working with CMake?