4 ms·
The language isn't great, but I have never spent more than a few hours trying to figure out how to do something in CMake. In other build systems, I've had to gi
by slavik81 8y ago
The language isn't great, but I have never spent more than a few hours trying to figure out how to do something in CMake. In other build systems, I've had to give up on some features after dozens of hours of trying. CMake is ugly, but it won because it works.
- lfowles 8y agoI'm still not convinced there's a good way in cmake to pull in and compile external libraries as dependencies. I know it can be done via a superproject method but that's a lot of boilerplate for something that should be straightforward. Everything else is simple and easy until I butt heads with that issue.
- berkut 8y agoIn my experience, ExternalProject_Add() isn't a lot of boilerplate. You specify the source, target dir, and other stuff can be optional.
- lfowles 8y agoIt's been a while since I've done this kind of CMake in anger, but I recall my main gripe with ExternalProject_Add is that it can't leverage that the external project is a CMake project and I still end up hard coding paths.
- svalorzen 8y agoNot sure if this can help you, but I simply use function (AddDependency name) add_subdirectory(${PROJECT_SOURCE_DIR}/deps/${name}) include_directories(${PROJECT_SOURCE_DIR}/deps/${name}/include) endfunction (AddDependency) And then use git submodule to clone all the dependencies I need in the deps folder. Everything then works automagically (assuming that the dependency is built through CMake).
- isaachier 8y agoCheck out https://github.com/ruslo/hunter https://github.com/ruslo/hunter for a fantastic CMake package manager built to solve this issue.
- geokon 8y agoI wrote up a little thing about all the alternatives https://geokon-gh.github.io/hunterintro.html https://geokon-gh.github.io/hunterintro.html. Tldr: Hunter is by far the best options and makes CMake painless. It also solves some multiple-dependency and toolchain issues that are nearly impossible to get right with vanilla CMake
- naikrovek 8y ago> I have never spent more than a few hours trying to figure out how to do something in CMake. A well designed tool would not need a user to spend "a few hours" to learn how to do a specific thing. People are far too in love with their annoying build systems. Soon, if not already, tools to build CMakeLists.txt from something simpler will exist. Eventually that will expand to the point it itself requires a tool to generate config files so that it can generate config files for cmake so that cmake can finally fail while generating whatever your compiler wants, and then you have to debug that shit. I remain to be convinced that build tools are even fundamentally useful.
- hasahmed 8y agoBuild tools not useful? So what you just re-write your entire gcc compilation command every time? Do you build the.o files separately or rebuild them every time even when they don't need it? This is where Make really shines. It's would be far top expensive to build projects in C if you had to recompile every file every time.
- naikrovek 8y agoUsually I write a batch file or shell script. Works great, no bullshit, easy to debug.