5/28/2023 0 Comments Make vs cmake![]() Integrating an external library which also works with the same tool Handling external libraries from the web/pre-built libraries (libX.a/X.lib)ĬMake supports ExternalProject_Add and IMPORTED libraries, which seems superior to the similar method in the last XMake example of the "Custom script" section, but I have no idea if that's the idiomatic XMake way to clone a git projects. What's the idiomatic XMake way to do this? I find it really awesome that in CMake you set per-target properties with a visibility, and simply using target_link_libraries "brings in" the properties you need from the dependent library, such as defined and include directories. Things I really prefer to see compared:Ĭreating an executable and a static library, and linking them together For an example, stating that XMake has an integrated package repository is great, but that's a single example. Personally, I prefer to see how a complex task is handled by each tool to fully comprehend its capabilities, or a mention if it isn't possible. I can add a prebuild/postbuild command easily, I can create a binary and add sources or compile definitions, and sometimes the syntax is a bit strange (is whitespace important in XMake? why do I need to use endif() instead of brackets in CMake?), but the examples are really, really similar. This article compares the really, really common tasks, which in my opinion, are pretty much the same in either tool. The model is the key not the implementation, someone just needs to extract the model into an XML schema or other portable type system and then it could even be specified as a recommended approach perhaps? It presents a model of the program deployment, dependencies, compilation steps from which these tasks can be implemented. ![]() ![]() generating visual studio or eclipse projects for debugging, dependency and include analysis, automating code gen and test tasks and packaging projects. I use CMake for many things besides actually compiling i.e. Would it not be possible to design a schema ( like an XML schema ) for a meta build system? Then the actual scripts / tools / magic black box used to declare, compile, run, update, integrate with ides etc would not matter so much? With all the wisdom of c++ experts teaching how to write "strongly typed" code the way CMake uses strings for everything baffles me.ĬMake has a strong argument for having its own scripting language but in reality this only applies to a tiny microcosm of cases where using existing scripting tools is unacceptable.Īt any rate I think the problem lies beyond the language used and revolves around the underlying model. It can do more and is a couple thousand lines shorter than the version of cmake it started with. We pulled cmake as a submodule in our project's repo, and had our own internal branch. Who the fuck wants to recompile their build tool twice a week just to work around its deficiencies? And that's what I was doing for a good while. Somehow, admittedly, they pulled off writing ugly stuff in a clean and understandable way - it's as if the design was done by a half-drunk committee, but coding was done by angles. Ugly, inflexible, mind-blowingly bad code, yet surely easy to understand and modify. It's very nice source code and quite understandable, but in spite of it they managed parts of it to be ugly hacks. PSA: cmake's "toolchain files" are only for the compiler families that cmake already supports.Ĭmake is used by a lot of people who have no idea what a pile of dung it is in some respects. Heck, I have a project where I just wrote a ninja file by hand, because getting cmake to generate one the way I wanted it to be generated was turning in a month-long endeavor. Shit that's trivial in plain old gnu make can be a week-longth endeavor in cmake. And not just "any" generator code: all generator code that cmake has. ![]() Well, guess what: you have to either write intermediate scripts that expose your compiler to cmake as if it was gcc or something of its ilk, or you have to modify the generator code to support your compiler. For example, suppose that you have a compiler you wish to add, and that compiler isn't gcc nor anything that has command line like any other compiler. The biggest gripe I have with cmake is that it makes stuff that's silly simple in almost all other make tools suddenly turn extremely complex.
0 Comments
Leave a Reply. |