[cmake-developers] [CMake 0014312]: Parallel builds using make break when two or more targets that share a dependency (or are dependent) are called explicitly

Mantis Bug Tracker mantis at public.kitware.com
Thu Jul 25 09:14:03 EDT 2013


The following issue has been SUBMITTED. 
====================================================================== 
http://www.cmake.org/Bug/view.php?id=14312 
====================================================================== 
Reported By:                Wojciech Knapik
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   14312
Category:                   CMake
Reproducibility:            always
Severity:                   major
Priority:                   high
Status:                     new
====================================================================== 
Date Submitted:             2013-07-25 15:14 CEST
Last Modified:              2013-07-25 15:14 CEST
====================================================================== 
Summary:                    Parallel builds using make break when two or more
targets that share a dependency (or are dependent) are called explicitly
Description: 
In the example below, the top level targets for "main" and "empty" have recipes
that call make. When make is called with -j, the two instances of make are
called in parallel and, knowing nothing about each other, race to finish the
same task.

In the real world, this breaks builds in very common use cases. E.g. when you
have 3 types of tests - ut, mt and it - it is reasonable to call `make -j24 ut
mt it'. If those targets happen to share dependencies, the build will break.

Creating top level targets that cover all such combinations is not an acceptable
solution.

Steps to Reproduce: 
$ cat CMakeLists.txt 
cmake_minimum_required(VERSION 2.8)
project(foo)
add_library(empty STATIC empty.cpp)
add_custom_command(TARGET empty POST_BUILD COMMAND echo whoops)
add_executable(main main.cpp)
target_link_libraries(main empty)
$ cd build
$ cmake ..
$ make -j empty main|grep whoops
whoops
whoops
$
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2013-07-25 15:14 Wojciech KnapikNew Issue                                    
======================================================================




More information about the cmake-developers mailing list