[CMake] Parallel make & custom command

Marcel Loose loose at astron.nl
Wed Jun 29 11:22:20 EDT 2011


Hi all,

I'm having a problem with a parallel 'make' where one or more sources
are generated by a custom command.

The situation is as follows. There are a couple of targets (executables)
that depend on the same source file being generated by a custom
command. 

I notice that, when doing a parallel build, the custom command is
executed multiple times, thereby potentially overwriting or corrupting
the same file that's generated in different threads.

My feeling is that this is caused by the fact that CMake generates a
build.cmake file for each target separately. Hence, when doing a
parallel build, these build.cmake files are also processed in parallel. 

Am I correct in this assumption? And if so, what's the proper solution
for this problem?

Best regards,
Marcel Loose.

-- 
Marcel Loose
Senior Software Engineer, Computing Group R&D, Astron, the Netherlands



More information about the CMake mailing list