<div dir="ltr"><span class="im">2015-06-22 22:39 GMT+09:00 Brad King <<a href="mailto:brad.king@kitware.com">brad.king@kitware.com</a>>:<br>
> On 06/21/2015 09:06 AM, 정언 wrote:<br>
>> internal macro defines a custom command that makes a copy of the<br>
>> default named report file to the specified <file> path. The custom<br>
>> command is not invoked until any other command requires the <file>,<br>
>> for example, from its dependencies.<br>
><br>
> This could be fixed by moving the copy logic to a second COMMAND<br>
> argument to the add_custom_command for the actual bison invocation.<br>
<br>
</span>This can't be a solution.<br>
<br>
Suppose we have a bison file `foo.y`. We get `foo.tab.c` and<br>
`foo.tab.h` (in default) as a result of running bison, and<br>
additionally `foo.output` if we put `--verbose`. What we need is, for<br>
example, `foo.verbose` with the same content as `foo.output`.<br>
The copying command should be run right after each execution of bison.<br>
However, add_custom_command never guarantees a running order of<br>
internal commands. The documentation says, the commands can run<br>
parallel so never ever put commands with implicit dependencies.<br>
Please see <<a href="http://www.cmake.org/cmake/help/v3.3/command/add_custom_command.html" rel="noreferrer" target="_blank">http://www.cmake.org/cmake/help/v3.3/command/add_custom_command.html</a>><br>
for details.<br>
<br>
Again, we have two custom commands as a result of passing `VERBOSE` to<br>
bison_target(). One runs bison, and the other runs cp. The former one<br>
produces header and source, BISON_${Name}_OUTPUTS. That's all, and<br>
most of targets are only dependent on them. Even FindFLEX example<br>
does:<br>
<<a href="http://www.cmake.org/cmake/help/v3.3/module/FindFLEX.html" rel="noreferrer" target="_blank">http://www.cmake.org/cmake/help/v3.3/module/FindFLEX.html</a>><br>
Please see the last example with add_executable(). So, in many cases<br>
we don't have any dependencies over the file by VERBOSE, the latter<br>
command (cp) will never run.<br>
How about making the former command dependent on the latter one? Doing<br>
that causes circular dependencies, because the latter is obviously<br>
dependent on the former, by `foo.output`.<br>
<br>
To avoid circular dependencies, we might have three custom commands in<br>
total; the first runs bison; the second runs cp which is dependent on<br>
the first; the third is dependent on the first and on the second.<br>
However, dependencies over BISON_${Name}_OUTPUTS would run the first<br>
one only.<br>
Or using add_custom_target? I'm not sure.<br>
<br>
I think VERBOSE can't be fixed to behave right.<br>
<br>
And this:<br>
<span class="im"><br>
> I think that can be added as a separate REPORT_FILE option that is<br>
> considered separately from the VERBOSE option and uses --report-file.<br>
> It could be an error if the discovered bison tool does not support<br>
> the option.<br>
<br>
</span>I think what I intended is misunderstood because of my poor<br>
explanation; my fault.<br>
<br>
If VERBOSE behaved right, REPORT_FILE would not have any benefits over<br>
it. But it doesn't. Should we keep VERBOSE not changed in this case,<br>
so almost same functionalities defined duplicate? I'm not sure either.<br>
<br>
Thanks.<br>
Eon​</div>