4 ms·
CMake is so nice compared to vanilla makefiles. I wonder if it can be used this way with Javascript.
by jgh 9y ago
CMake is so nice compared to vanilla makefiles. I wonder if it can be used this way with Javascript.
- josteink 9y agoMaybe I'm wrong, but I always assumed CMake was optimized for the C language (thus the name)? That's at least what I've always seen it used for. What would you gain if you're using it for other, less supported languages, like Javascript?
- jgh 9y agoIt lets you generate makefiles in a less verbose way. Like if you have a lot of files in a project or a bunch of targets Makefiles can get a bit unwieldy by themselves. I've only ever used it for C++, but I don't see why it (or something like it) couldn't be used for other languages too.
- isaachier 9y agoCMake is mostly dedicated to C/C++ projects, but also has built-in support for assembly, Fortran, and Java. CMake has templates for adding a new language as well. The benefits are: cross-platform "shell" commands (you can copy files without using an explicit cp), standard lookup for programs, and easy target generation from a collection of files. Most languages are pretty similar to C/C++ when it comes to the build cycle. Portability (i.e. testing for existence of headers) is less of a concern for something like Javascript, but everything else still applies.
- digi_owl 9y agoGotta love all caps options with a prefix(?) that only shows up on the command line...
- ethagnawl 9y agoI'll second this. I had to use CMake for the first time recently and was pleasantly surprised by the experience. This tutorial was making the rounds (on HN and elsewhere) last week, but in case anyone missed it, here's a link: https://github.com/pyk/cmake-tutorial https://github.com/pyk/cmake-tutorial I found it to be a great primer/refresher.
- yoz-y 9y agocmake is good but it is quite heavily geared towards C/C++ development. I would love to have some modern makefile with a bit nicer syntax. Fitting into 80 columns is no longer a must.
- gjvc 9y agoIn case you didn't know, the 80 column limitation has its origins here https://en.wikipedia.org/wiki/Punched_card#IBM_80-column_punched_card_format_and_character_codes https://en.wikipedia.org/wiki/Punched_card#IBM_80-column_pun...
- yoz-y 9y agoInteresting. How why the size of the card affect the size of the screen? I have assumed that it was kind of a good number for size of screens at that time.
- gjvc 9y agoIt most probably wasn't a limitation so much as a convention carried over from one generation of technology to the next in order to ensure the adoption of the latter.
- armitron 9y agoMake may seem crude these days but has manageable complexity, I've never run across a build issue I could not debug. Its model is so simple, I can have it fully in my mind and be confident this is how it works. Moreover, this model simplicity allows me to build reliable systems on top of it. CMake is a nightmare of implied complexity. I've run into multiple situations (usually but not always involving cross-compilation) where it was simply incomprehensible. No amount of time invested would let me figure out why CMake blew up. There is no way I can build something a little out of the ordinary on top of CMake and be confident that it's solid. It's just too complicated. This sort of balancing, upfront ease of use vs hidden complexity comes up often and I have been burned enough in the past that experience dictates to pretty much always go for model simplicity and pay the upfront costs. I don't see this often however. A lot of the time people will go for what feels or looks right, superficially, without bothering to look beneath the surface or think about model complexity costs. It's an attitude that has led to many disasters in this space.
- jgh 9y agoFair enough but it could be that CMake isn't the right tool across the board. It works well for the projects I've used it for. Maybe one day I'll come across a case that makes me hate CMake though who knows ;)
- planteen 9y agoI do embedded work. I agree CMake is horrible when cross-compiling and runs into trouble. The errors make no sense. It took me days to get OSG cross-compiling. It was a horrible experience. I'd much rather a Makefile where I can override the compiler and flags for my configuration. I can easily figure out what I need to do based on compiler and linker errors for missing headers and libraries.
- LukeShu 9y agoAs a distro packager, Autotools may be a mess, but debugging a package that won't build is fairly straight-forward. If the package uses CMake though, and there's a weird build issue, debugging that can be a nightmare! Everything is so opaque, with tons of implied complexity! CMake may be nice to write, but it's hell to debug.
- user404d 9y agoI like this idea a lot. I personally don't like writing makefiles and so having nice build tools like cmake generate them for me is about as close to writing them as I want to get. Letting make stay as a low level building block for high level build tools seems like the right way to go.