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

Eric Noulard eric.noulard at gmail.com
Thu Jun 12 07:52:34 EDT 2014


2014-06-12 12:18 GMT+02:00 Adam Strzelecki <ono at java.pl>:
>> 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.

The appropriate info is at the top:

Usage

  cmake [options] <path-to-source>
  cmake [options] <path-to-existing-build>


that said the invocation of cmake without any argument may generated
smaller and more readable message.
May be you can propose a patch for 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.

CMake respect his users so backward compatibility is very important.
Forbidding in-source build should be user controllable:
http://public.kitware.com/Bug/view.php?id=6672

>
> 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.

I think CMake is made for developers and not for "stupid" user,
developer should at least read the doc of the tool they use.

That said if average user is to be supported then developper of
project using CMake and expecting their user to use CMake
should probably provide a script which provide "simple dummy usage",
this script could invoke CMake with appropriate
default argument value.

Regards,
Eric

>
> Regards,
> --
> Adam
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake



-- 
Erk
L'élection n'est pas la démocratie -- http://www.le-message.org


More information about the CMake mailing list