[CMake] Why simple `cmake` does not launch default generator on current directory?

Adam Strzelecki ono at java.pl
Thu Jun 12 06:18:49 EDT 2014


> Because that would create an in-source build, and you almost never want that. 
> One wants to build out of source. Sadly CMake will stumble if you try to 
> create an out-of-source build from a directory that is an in-source build, so 
> not having that default of "cmake ." actually saves everyone a lot of trouble.

It is clear to me that out-of-source builds are better for many reasons, but I don't see how `cmake` dumping 3 pages of usage not mentioning anything about that lets user to understand that.

Moreover there is a lack of consequence whether path argument is obligatory or not, because `cmake -GNinja` or `cmake -DDUMMY=1` works in source directory without needing to specify extra dot.

In-source builds may be convenient too if you're working remotely via ssh in git managed folder, which I do a lot. This saves you lot of `cd` typing and it is quicker to do `git clean ...` than move forth and back to build folder.

If CMake is supposed to be meta-`make`, why it doesn't behave like `make`? If it suppose to help understand what is going on it should output rather:

===
CMake Warning: Current directory is source directory. Out-of-source builds are recommended.
Specify `cmake .` to skip this warning or create separate build folder.
===

But I am really against that, since command line user shouldn't be treated like stupid user. Anyway for beginners GUI is preferred way to go.

Regards,
-- 
Adam


More information about the CMake mailing list