[CMake] custom commands not run in parallel with Visual Studio (2010) generator

Thomas Sondergaard ts at medical-insight.com
Fri Aug 5 06:18:50 EDT 2011


On 12-10-2010 15:55, Bill Hoffman wrote:
> On 10/12/2010 9:09 AM, Thomas Sondergaard wrote:
>> Hi,
>>
>> I've noticed that Visual Studio doesn't run custom commands added with
>> add_custom_command in parallel. This means running moc and uic is slow
>> on Windows. Is there something that can be done about this?
>>
>
> No, I don't think so, VS does not work like that. It only does target
> parallelism. Not per-command parallelism. It never has don that... You
> can get the compiler to do it with the /MP flag, but not custom
> commands, unless the command itself supported it.
>
> -Bill

Couldn't cmake provide a generic wrapper around commands to allow 
multiple to be run, e.g

cmake --run --command "moc -o moc_foo.cc foo.h" --command "moc -o 
moc_bar.cc bar.h"

or the following where moc_script.txt contains one line per command

cmake --run --command-script moc_script.txt

With such cmake support you could use add_custom_command with multiple 
outputs to get things like moc and uic generation done in parallel, 
couldn't it?

Best regards,

Thomas



More information about the CMake mailing list