{"id":72,"date":"2006-09-06T23:27:31","date_gmt":"2006-09-06T12:40:45","guid":{"rendered":""},"modified":"2006-09-06T23:27:31","modified_gmt":"2006-09-06T23:27:31","slug":"cmake_why","status":"publish","type":"post","link":"https:\/\/blogs.gentoo.org\/lu_zero\/2006\/09\/06\/cmake_why\/","title":{"rendered":"CMake&#8230; why?"},"content":{"rendered":"<p>I just did some comparisons about cmake and something better like&#8230; autotools?<\/p>\n<p>Step 0:<\/p>\n<p>Some numbers just for fun:<\/p>\n<p>nemesi lu_zero # qlop -tH cmake<br \/>\ncmake: 13 minutes, 35 seconds for 1 merges<br \/>\nnemesi lu_zero # qlop -tH make<br \/>\nmake: 1 minute, 0 seconds for 2 merges<br \/>\nnemesi lu_zero # qlop -tH bash<br \/>\nbash: 2 minutes, 32 seconds for 3 merges<br \/>\nnemesi lu_zero # qlop -tH perl<br \/>\nperl: 7 minutes, 52 seconds for 4 merges<br \/>\nnemesi lu_zero # qlop -tH m4<br \/>\nm4: 32 seconds for 1 merges<br \/>\nnemesi lu_zero # qlop -tH automake<br \/>\nautomake: 1 minute, 8 seconds for 7 merges<br \/>\nnemesi lu_zero # qlop -tH autoconf<br \/>\nautoconf: 30 seconds for 4 merges<\/p>\n<p>Ok cmake is a ugly hog at least while building.<\/p>\n<p>Step 1:<br \/>\nWhat you want from your build system:<\/p>\n<p>&#8211; take as little resources as possible<br \/>\n&#8211; have it as much portable as possible<br \/>\n&#8211; have as little as possible to write<br \/>\n&#8211; have a good way to express conditionals<br \/>\n&#8211; let you have your program correctly built on a large number of arches.<br \/>\n&#8211; automagically spot dependencies<br \/>\n&#8211; let you use tools like distcc and ccache in an effective way<\/p>\n<p>Step 2:<\/p>\n<p>Uglyness scale before cmake:<\/p>\n<p>imake, scons: bad ideas with a bad implementation, everybody knows that, somebody is workarounding scons a lot, I hope for a fork.<\/p>\n<p>qmake: not sure which part is bad, nobody likes to use it that much for a reason or another.<\/p>\n<p>plain make: simple and to the point, it may not scale that well.<\/p>\n<p>autotools: most people misuse them, many despise certain choices. The lack of good documentation and the version incompatibilities made them in a bad light, things are getting better little by little. The most used system despite the ugly Makefiles produced. I&#8217;d use them with their reference at hand.<\/p>\n<p>kbuild: it is wonderful, works really well once you lay it out, it is even simple! Problem: you don&#8217;t have a stand alone template to fill so it is much an hacking over existing deployments.<\/p>\n<p>Step 3:<\/p>\n<p>put cmake in the scale:<\/p>\n<p>1- takes forever to build<br \/>\n2- is compact<br \/>\n3- uses the same approach as aclocal m4 files (call them Modules\/*.cmake) but has a risible number of them.<br \/>\n4- supports less platforms than autotools<br \/>\n5- the syntax is a brain damage between imake and autotools<br \/>\n6- Hype points because kde4 could use it<\/p>\n<p>Step 4:<\/p>\n<p>When it could have sense:<\/p>\n<p>1- your project is targeting what cmake supports already<br \/>\n2- you like its brain damages more than others<br \/>\n3- you misused autotools and now you are trying to misuse another build system (hopefully it won&#8217;t make you misuse it that much).<br \/>\n4- you absolutely love the ability to have project files for some commonly used proprietary ides out of the cmake native files.<br \/>\n5- you want to gain some hype points to your project.<\/p>\n<p>Summary:<\/p>\n<p>cmake is a wonderful technology that should take the way of the dodo and never touch your hard disk, gives nothing more than a lobotomized autotools (and that is good since you can commit less mistakes) has the good mix of hype points and laziness compliant features.<\/p>\n<p>In short cmake developers feel free to ignore me, this is a rant, I hadn&#8217;t wrote a build system that will be used by a large project and probably I&#8217;m not so entitled to write such large stain of venom.<\/p>\n<p>You obviously can take it seriously and prove me wrong with a next version with 1\/2 the build time, less overhead and a nicer syntax.<\/p>\n<p>UPDATE:<\/p>\n<p>flameeyes told me that cmake doesn&#8217;t have a way to set cflags\/ldflags\/asflags on a per target basis. So it is a wonderful regression to pile up to the rest&#8230;<\/p>\n<p>UPDATE2:<\/p>\n<p>http:\/\/dev.gentoo.org\/~lu_zero\/development\/cdrkit-1.0pre3.tar.bz2<br \/>\nI played a bit with autotools to see how bad they are and\/or how good cmake is&#8230;<br \/>\nI started from scratch for the first time using autotools&#8230;<br \/>\nThere are some minor changes but nothing interesting.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I just did some comparisons about cmake and something better like&#8230; autotools? Step 0: Some numbers just for fun: nemesi lu_zero # qlop -tH cmake cmake: 13 minutes, 35 seconds for 1 merges nemesi lu_zero # qlop -tH make make: 1 minute, 0 seconds for 2 merges nemesi lu_zero # qlop -tH bash bash: 2 &hellip; <a href=\"https:\/\/blogs.gentoo.org\/lu_zero\/2006\/09\/06\/cmake_why\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">CMake&#8230; why?<\/span><\/a><\/p>\n","protected":false},"author":10,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true},"categories":[3,4],"tags":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p1aGWH-1a","_links":{"self":[{"href":"https:\/\/blogs.gentoo.org\/lu_zero\/wp-json\/wp\/v2\/posts\/72"}],"collection":[{"href":"https:\/\/blogs.gentoo.org\/lu_zero\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.gentoo.org\/lu_zero\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.gentoo.org\/lu_zero\/wp-json\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.gentoo.org\/lu_zero\/wp-json\/wp\/v2\/comments?post=72"}],"version-history":[{"count":0,"href":"https:\/\/blogs.gentoo.org\/lu_zero\/wp-json\/wp\/v2\/posts\/72\/revisions"}],"wp:attachment":[{"href":"https:\/\/blogs.gentoo.org\/lu_zero\/wp-json\/wp\/v2\/media?parent=72"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.gentoo.org\/lu_zero\/wp-json\/wp\/v2\/categories?post=72"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.gentoo.org\/lu_zero\/wp-json\/wp\/v2\/tags?post=72"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}