View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0014059CMake(No Category)public2013-04-03 11:092013-10-07 10:04
Reporterashuang 
Assigned To 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionnot fixable 
PlatformOSUbuntuOS Version10.04 i386
Product VersionCMake 2.8.9 
Target VersionFixed in Version 
Summary0014059: CMake double executes a custom command when multiple custom target depend on it
DescriptionCMakeLists.txt:

cmake_minimum_required(VERSION 2.8)

add_custom_command(OUTPUT a.txt
    COMMAND touch a.txt
    COMMENT "Making a")

add_custom_target(b ALL COMMENT "Making b" DEPENDS a.txt)
add_custom_target(c ALL COMMENT "Making c" DEPENDS a.txt)
add_custom_target(d ALL COMMENT "Making d" DEPENDS a.txt)
Steps To ReproduceRun:
$ cmake .
$ make -j 3
[ 16%] [ 33%] [ 50%] Making a
Making a
Making a
[ 66%] [ 83%] [100%] Making b
Making d
Making c
[100%] [100%] Built target b
Built target d
[100%] Built target c
Additional InformationI would expect to see only one instance of "Making a".

When I use this pattern with a more complex add_custom_command(), the output file gets corrupted because multiple processes are writing to the file at the same time.
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0032749)
Brad King (manager)
2013-04-03 11:25

http://www.cmake.org/Wiki/CMake_FAQ#How_can_I_generate_a_file_used_in_more_than_one_target_in_the_same_directory.3F [^]
(0034024)
Robert Maynard (manager)
2013-10-07 10:04

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2013-04-03 11:09 ashuang New Issue
2013-04-03 11:25 Brad King Note Added: 0032749
2013-04-03 11:25 Brad King Status new => resolved
2013-04-03 11:25 Brad King Resolution open => not fixable
2013-10-07 10:04 Robert Maynard Note Added: 0034024
2013-10-07 10:04 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team