I want to start some command and store its output into some variable. And then reconfigure input file that depends of this variable.

For instance, I want to get current mercurial revision by running `hg id -i`. Output of this command can be changed between builds. So, I have to run this command every time and store output into some variable.

So, because I have to run this command every build, then `execute_process` is not suitable to me. But `add_custom_command` is not suitable too because it cannot save output of the command into a variable.

Let's suppose that I could (in some way) get output of `hg id -i` and store it into `REVISION` variable. Then I want to regenerate configuration file with version:

```
configure_file(version.cpp.in version.cpp)

```

Contents of `version.cpp.in`

```
volatile const char* revision = "Revision: ${REVISION}";

```

As a workaround I can define `REVISION`, but I want to have revision number in source files.

P.S. Mercurial and revision number here is just an example. So, please don't advise some Mercurial's `keyword` extension and so on.