News for hackers. Stuff that matters.
Re:Show HN: Minecraft clone in 2500 lines of C - even suppor... by krakensden on Tuesday December 10, 2013 @02:19AM (#6879428)
Welcome to the pile of busted that is CMake. If you do it for a living, you'll even get to learn their wonderful psuedo language, so you can parse through 450 lines of Find*.cmake just to figure out that all it does is check ENV_VAR0 and then fall back to a hardcoded string- even though the documentation/header claims it checks ENV_VAR1.
Re:Show HN: Minecraft clone in 2500 lines of C - even suppor... by csmuk on Tuesday December 10, 2013 @03:46AM (#6879643)
This.

CMake is another barrier to entry.

what happened to a nice simple makefile? Been using just standard makefiles for literally 20 years.

The only thing I do is put a checkdeps dependency on which tests for the presence of dependencies, like autoconf but without the eye poking. Have built everything from small network servers to Motif behemoths doing only that.

Re:Show HN: Minecraft clone in 2500 lines of C - even suppor... by zurn on Tuesday December 10, 2013 @04:30AM (#6879764)
You get no (compatible) make on MSVC. More imporantly, whith nontrivial dependencies to third party libraries, self-coded makefiles just break down. Cross-platform handling of dependencies is fragile and makes drudgery. You're liable to do worse than CMake - after wasting a lot of time and energy.

CMake is more an alternative to GNU autoconf and pals, with the difference that it has first class support for things like MSVC and XCode.

Re:Show HN: Minecraft clone in 2500 lines of C - even suppor... by csmuk on Tuesday December 10, 2013 @05:09AM (#6879877)
I don't build for windows so that's moot for me. Well I do but not C.

I've quite happily built makefiles that work on Linux, FreeBSD, Solaris and HP/UX that aren't fragile or laborious. It just takes appropriate knowledge of the platforms. I've built some stuff on OSX (small SDL project) and it wasn't too obtuse apart from some paths.

CMake, much as all of these things, works up to a point at which point it tries desperately to kill you at every available opportunity.

Re:Show HN: Minecraft clone in 2500 lines of C - even suppor... by blueblob on Tuesday December 10, 2013 @08:44AM (#6880623)
Is nmake not compatible with make? I thought that it was. I haven't programmed C/C++ on Windows at all though, so I have no experience with this.
Re:Show HN: Minecraft clone in 2500 lines of C - even suppor... by zurn on Tuesday December 10, 2013 @01:37PM (#6882636)
Microsoft "nmake" is unrelated to the AT&T-originated Unix "nmake", which you may be thinking of.

(people rarely even attempt nontrivial Makefiles that are portable between BSD and GNU makes though...)

Re:Show HN: Minecraft clone in 2500 lines of C - even suppor... by krakensden on Wednesday December 11, 2013 @01:25AM (#6886235)
Not really- that, and it is incredibly feature poor.
Re:Show HN: Minecraft clone in 2500 lines of C - even suppor... by nicholassmith on Tuesday December 10, 2013 @05:34AM (#6879939)
Whenever I see a project with CMake it generally puts me off as I know it's liable to require some intervention from me to get it just building.
Re:Show HN: Minecraft clone in 2500 lines of C - even suppor... by galaktor on Tuesday December 10, 2013 @04:18AM (#6879732)
It drove me crazy when I realized that CMake "achieves" being cross-platform by having you write tons of IF/ELSE conditions for every single platform you decide to support. My (naive?) understanding of cross platform was that it would abstract away most of those platform specific details.
Re:Show HN: Minecraft clone in 2500 lines of C - even suppor... by csmuk on Tuesday December 10, 2013 @05:17AM (#6879902)
That's what I thought when we tried to move one of our projects to CMake. By the second platform, we'd given up.

Not only that, some of it doesn't actually work properly and it refuses to compile itself on HPUX.

Re:Show HN: Minecraft clone in 2500 lines of C - even suppor... by tenfingers on Tuesday December 10, 2013 @05:57AM (#6880012)
That's pretty much the same for GNU autotools, by the way.

Beyond the common platforms (linux, freebsd and sometimes cygwin), autotools break regularly, because they are not tested as well as on linux. Macros provided by libraries are even more prone to these issues.

I remember I had huge issues on IRIX to make even simple projects compile, so much that "irixfreeware" had an unsupported/patched automake that fixed some of these issues if you could have the luxury of re-generating the configure. Add to that that autotools broke backward compatibility of the configure.in scripts very often, and this is why debian has all versions of automake starting from 1.4 coexisting in the repository, and my patched automake was next to useless.

CMake is generally less painful if you learn it a bit. For the same level of underlying knowledge, CMake is way easier to "fix" when the build breaks, because it's a single tool, with an API which is quite consistent and doesn't involve a lot of magic. Fixing a configure failure with automake is hell by comparison. Fixing a Make failure with automake is also harder.

That being said, I generally dislike CMake. The syntax is just horrible (did they actually try to copy automake here?). The build system is still convoluted, and the output is basically unmodifiable. It doesn't "help" you much in porting to other operating systems either, really, like you say.

For some people, CMake just provides a convenient way to build the software by exporting a VS project file. I would never recommend to export Xcode projects by contrast, since you can just as well use the normal Makefile approach on OSX.

Writing correct tests for feature discovery in automake is very hard. I cannot count the times some tests fail to properly detect an include/library/path because of a different compiler version and/or because the script writer tried to mess with CFLAGS/LDFLAGS. The same in CMake is saner on that front, at least.

But did I already say I don't like CMake?

Re:Show HN: Minecraft clone in 2500 lines of C - even suppor... by agentultra on Tuesday December 10, 2013 @10:01AM (#6881041)
> Fixing a configure failure with automake is hell by comparison.

autotools. never again.

I had the fortunate pleasure of fixing a package on CentOS. The program needed to copy/write files in /tmp and back which meant configuring and compiling SELinux policies. This was such a pain in the ass to get working in autotools.

Cmake is a breeze by comparison.

Re:Show HN: Minecraft clone in 2500 lines of C - even suppor... by LinaLauneBaer on Tuesday December 10, 2013 @06:01AM (#6880028)
CMake abstracts the generation of platform specific files like Xcode projects, makefiles and Visual Studio projects. This does not mean that you have to write tons if-defs.
Re:Show HN: Minecraft clone in 2500 lines of C - even suppor... by krakensden on Wednesday December 11, 2013 @01:26AM (#6886236)
galaktor isn't talking about #ifdefs, galaktor is talking about CMake-language special casing.
Re:Show HN: Minecraft clone in 2500 lines of C - even suppor... by angersock on Tuesday December 10, 2013 @04:00PM (#6883669)
I was going to contribute a VS2012 and VS2008 project, but honestly I saw CMake and just kind of groaned.