15

I'm learning CMake, reading the "Mastering CMake" book and other online available stuff. I wonder is there a detailed documentation for some command line options, for example -H, and -B which are used by generated files. Or the "-E echo" has additional options for coloring etc. I was not able to find some documentation for this yet.

Right now I saw this for CMake version 3.14.4:

$ cmake --help ... cmake [options] -S <path-to-source> -B <path-to-build> ... -S <path-to-source> = Explicitly specify a source directory. -B <path-to-build> = Explicitly specify a build directory. ... 

Is this the official version of -H and -B?

1

3 Answers 3

13

Definitely not. You do have to look at the source code of CMake.

The online docs are good, but there are some private-ish implementation details that we intentionally leave out of the official docs. Command-line stuff we use from generated projects and makefiles are some of those details.

Online docs here:

Documented command line options here:

Overview page, pointing to other sources of information:

Sign up to request clarification or add additional context in comments.

4 Comments

Thanks Dave for this information. To be honest I'm very interested in some of the hidden command line options because it is helpful for my own set of combinded projects. Especially the posibility to color echo output helps to read the makefile messages. And the possibility to call cmake for out-of-source build without creating the build-dir first with -B and -H sound very interesting. Maybe you will publish it in future versions. Kind regards, Andi
Why would you do this? Why would you intentionally make things hard?
I don't think the CMake developers have intentionally made things difficult. And I'm quite certain that is not one of their goals...
@DLRdave Perhaps, for those interested, you could reference where these options can be found in the source?
3

Cmake documentation has sensibly improved in the meantime, but -H<directory> and -B keep being hidden, probably for good reasons (they shouldn't be used outside of CMake development context).

-H<directory> and -B are both explained here.

For cmake -E, options are documented in this section.

3 Comments

I cannot confirm the your doubts regarding -H and -B. I use CMake version 3.5.1 with this options, it still works. If you try only "cmake -H" it prints help, but using "cmake -H." for example shows an error message like "CMake Error: The source directory ... does not appear to contain CMakeLists.txt.". -B is fine too.
Well, if it is undocumented, you cannot rely on it. They might change or break it anytime.
@usr1234567 Exactly!
1

Probably not. You might have to look at the source code of CMake.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.