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

Nils Gladitz nilsgladitz at gmail.com
Wed Jun 11 15:39:18 EDT 2014


On 11.06.2014 21:28, Adam Strzelecki wrote:
> Hello,
>
> We started using CMake recently in our projects. And it is really a timesaver comparing to Qmake/autotools, however there is one thing that bothers me.
>
> Why typing simple: cmake in command line doesn't trigger configure with default generator (i.e. Makefile)? It just prints help, which is anyway accessible via cmake -h/--help.
>
> This is really weird comparing to other tools such as ./configure, quake, make, that do not expect any parameter to launch them up.
>
> Fortunately there is `cmake .`, but the dot is kinda superfluous.
>

The preferred way to build with cmake is "out-of-source" [1].
Which means that the source directory remains untouched and all build 
artifacts go to a separate build directory.
For that you create an empty directory and call "cmake <path to source 
directory>" from it.

This will allow you to have multiple build directories that work with a 
single source directory.
It also makes it easier to discard a build.

Nils

[1] http://www.cmake.org/Wiki/CMake_FAQ#Out-of-source_build_trees


More information about the CMake mailing list