[CMake] Problems with parallel builds

Marcel Loose loose at astron.nl
Thu Nov 18 07:55:18 EST 2010


>>> On 18-11-2010 at 13:06, in message
<306960.51089.qm at web65407.mail.ac4.yahoo.com>, Denis Scherbakov
<denis_scherbakov at yahoo.com> wrote: 
> Dear All,
> 
> I am using CMake 2.8.1 on Linux x86. I have a project that needs to
be built 
> two times. One with -fPIC, the other - without. The project depends
on header 
> files that need to be generated by an external script.
> 
> When I build this project with several parallel jobs (gmake -j5, for
example) 
> to my disappointment CMake calls external script several times so at
the end 
> I get corrupted header files.
> 
> Does anybody know a cross-platform way of implementing a mutex (or
something 
> like that) to make sure that scripts that generate files are called
only 
> once?
> 
> So far for me parallel builds do not work with CMake at all. 
> 
> Thanks.
> Denis
> 
> 
>       
> _______________________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at 
> http://www.kitware.com/opensource/opensource.html
> 
> Please keep messages on-topic and check the CMake FAQ at: 
> http://www.cmake.org/Wiki/CMake_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake

Hi Denis,

If you have two different build directories, which you need to have
anyway when compiling with and without -fPIC, then you shouldn't have a
problem, as long as you generate those header files in the build
directory, which is IMHO the only sensible place to put generated files
(your source tree might even be read-only!). Or maybe I completely
misunderstood your question.

Best regards,
Marcel Loose.



More information about the CMake mailing list