[CMake] Trouble with parallel builds for targets created by add_executable, target_link_libraries, and add_library
Alan W. Irwin
irwin at beluga.phys.uvic.ca
Tue Sep 29 16:34:42 EDT 2009
As part of the build of PLplot and for STRING_INDEX = 01, 02, ...,
I have created test targets x01c, x02c,.... with
add_executable(x${STRING_INDEX}c x${STRING_INDEX}c.c)
target_link_libraries(x${STRING_INDEX}c plplot${LIB_TAG})
where LIB_TAG is "d", and plplotd is a target created by add_library when
our core library is built. I have simplified our build so that libplplotd
only depends on one other internal library (via target_link_libraries)
called qsastime, and there are no dependencies on custom targets or custom
commands.
For this simplified build, if I try
make -j2 x01c x02c
I get double builds of both qsastime and plplotd which often (if the timing
is right) interfere with each other on my dual core hardware platform. No
such build problems occur if I drop the -j option.
Shouldn't add_executable, target_link_libraries, and add_library "just work"
for parallel builds if no custom targets or custom commands are involved
directly or indirectly with the build? Or do I have to do something
extra to get parallel builds to work for this simplified case?
The strange thing is for a long time I have never had parallel build
troubles with plplot for "make" or "make all" so I felt all our historical
file and target dependency issues were fixed. However, recently I have
begun testing individual target builds like above, and I ran into parallel
build problems as I have described even for the most simplified case which
handles all dependencies automatically via add_executable,
target_link_libraries, and add_library.
Any help or advice to get this sorted out would be most appreciated. I have
confirmed the issue for both CMake-2.6.4 and CMake-2.6.0.
Alan
__________________________
Alan W. Irwin
Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).
Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of
Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__________________________
Linux-powered Science
__________________________
More information about the CMake
mailing list