[CMake] Problems with parallel builds

Eric Noulard eric.noulard at gmail.com
Thu Nov 18 08:13:49 EST 2010


2010/11/18 Denis Scherbakov <denis_scherbakov at yahoo.com>:
> 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.

Could you give us the exact CMake rule/command you use to generate
those headers?

configure_file?
add_custom_command?
add_custom_target?
execute_process?
... combination of those ?

> 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.

I did never had any trouble with parallel building with CMake on Linux
with makefile generator so far.
For build host ranging from 1 processors to 4 processors with various -j values.

-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org


More information about the CMake mailing list