View Issue Details [ Jump to Notes ] | [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
0015116 | CMake | CMake | public | 2014-08-29 13:11 | 2015-11-02 09:13 | ||||
Reporter | Vijay Pradeep | ||||||||
Assigned To | Brad King | ||||||||
Priority | normal | Severity | minor | Reproducibility | always | ||||
Status | closed | Resolution | fixed | ||||||
Platform | Linux | OS | Ubuntu | OS Version | 12.04 | ||||
Product Version | CMake 2.8.12.2 | ||||||||
Target Version | CMake 3.2.1 | Fixed in Version | CMake 3.2.1 | ||||||
Summary | 0015116: cmake add_custom_command issue with multiple output files | ||||||||
Description | I'm noticing some potential incorrect behavior in cmake when working with add_custom_command and multiple output files. I've been able to isolate the problem to a minimal example (see below). It seems that when I have two output files specified in my add_custom_command, the second output file's upstream dependencies are not being tracked correctly in some cases. The cmake documentation clearly mentions that multiple output files are allowed. What's interesting here is that swapping the order of the output files causes different behavior, suggesting that the first OUTPUT file is being treated differently. (Crossposted here: http://stackoverflow.com/questions/24416133/cmake-add-custom-command-issue-with-multiple-output-files [^]) | ||||||||
Steps To Reproduce | Example CMakeLists.txt: cmake_minimum_required(VERSION 2.8) add_library(mybaz baz.cpp) add_custom_command( OUTPUT baz2.cpp COMMAND cp baz.cpp baz2.cpp DEPENDS baz.cpp COMMENT "Copying baz.cpp to baz2.cpp") add_custom_target(mytarget DEPENDS baz2.cpp COMMENT "Running mytarget") add_dependencies(mybaz mytarget) add_custom_command( OUTPUT bar.cpp baz.cpp COMMAND cat a.txt > bar.cpp COMMAND cat a.txt > baz.cpp DEPENDS a.txt COMMENT "Generating bar.cpp and baz.cpp") ====================================================== Below are the commands that I run: > touch a.txt > cmake . ...snip... (configuration runs fine) > make Scanning dependencies of target mytarget [ 20%] Generating bar.cpp and baz.cpp [ 40%] Copying baz.cpp to baz2.cpp [ 60%] Running mytarget [ 60%] Built target mytarget Scanning dependencies of target mybaz [ 80%] Building CXX object CMakeFiles/mybaz.dir/baz.cpp.o Linking CXX static library libmybaz.a [100%] Built target mybaz (everything looks good) > touch a.txt > make [ 20%] Generating bar.cpp and baz.cpp [ 40%] Running mytarget [ 60%] Built target mytarget Scanning dependencies of target mybaz [ 80%] Building CXX object CMakeFiles/mybaz.dir/baz.cpp.o Linking CXX static library libmybaz.a [100%] Built target mybaz (I seem to be missing the 'Copying baz.cpp to baz2.cpp' line) > make [ 20%] Copying baz.cpp to baz2.cpp [ 40%] Running mytarget [ 60%] Built target mytarget [100%] Built target mybaz ( The 'Copying baz.cpp to baz2.cpp' executes this time ) | ||||||||
Tags | No tags attached. | ||||||||
Attached Files | console_output_ubuntu_14_04_cmake_2_8_12_2.txt [^] (2,558 bytes) 2014-12-04 11:41 [Show Content] | ||||||||
Relationships | |
Relationships |
Notes | |
(0036825) Shootfast (reporter) 2014-09-18 12:36 |
Hi, just reporting that I am also experiencing this bug on cmake 3.0.0. |
(0037312) Rongcui Dong (reporter) 2014-11-28 23:17 |
Not reproduced on cmake version 2.8.12.2 under Ubuntu 14.04 |
(0037382) Vijay Pradeep (reporter) 2014-12-04 11:48 |
Hi Rongcui, I just repeated the posted 'steps to reproduce' on Ubuntu 14.04 with CMake 2.8.12.2, and I am still seeing the error. I've also uploaded my full console output from this test for further inspection at console_output_ubuntu_14_04_cmake_2_8_12_2.txt. I'm not sure why we would be seeing different outcomes when we're running the same OS and CMake. I think it would be insightful to compare your console output the the one I just uploaded. If you have a moment, could you please rerun the experiment and upload it? Thanks! |
(0037388) Rongcui Dong (reporter) 2014-12-04 15:06 |
Wait, I think I misunderstood your output. Yes, it behaves exactly like your post. I missed that "Copying" part. |
(0037389) Brad King (manager) 2014-12-04 15:13 |
I can reproduce this too. You're correct that the first output is being treated specially by the Makefile generator. I'm not sure why things were done that way. Instead the multiple output rules should list all outputs on the left hand side of the make rule. I'm working on a fix. |
(0037404) Brad King (manager) 2014-12-08 09:02 |
Fixed and test added: Xcode: Fix rebuild with multiple custom command outputs http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8a4c6d2d [^] Makefile: Fix rebuild with multiple custom command outputs http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=644b4688 [^] Tests: Cover rebuild with multiple custom command outputs http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=65ea5eb7 [^] Makefile: Workaround Borland Make bug with multiple outputs http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6c67b816 [^] |
(0037447) Vijay Pradeep (reporter) 2014-12-12 12:12 |
@(Brad King): Thanks for the fix! This will definitely help streamline users' CMake experiences when trying to put together and debug complex CMake projects. |
(0038168) Brad King (manager) 2015-03-06 15:35 |
The fixes in 0015116:0037404 caused a major regression: Wrong behavior with 3.2.0-rc2 http://thread.gmane.org/gmane.comp.programming.tools.cmake.user/51919 [^] Using the style out1 out2: depends... commands... is actually just equivalent to out1: depends... commands... out2: depends... commands... so in parallel builds the commands run multiple times at once. |
(0038169) Brad King (manager) 2015-03-06 15:39 |
Re 0015116:0038168: This is likely the cause of this report too: Parallel build of webkitgtk4 fails with cmake 3.2 https://bugzilla.redhat.com/show_bug.cgi?id=1199360 [^] |
(0038170) Brad King (manager) 2015-03-06 15:42 edited on: 2015-03-06 20:00 |
Re 0015116:0038168: I've drafted the following fix: Makefile: Fix multiple custom command outputs regression http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=66a9c90c [^] which will be included in 3.2 if it passes nightly testing, and will otherwise be revised. |
(0039723) Robert Maynard (manager) 2015-11-02 09:13 |
Closing resolved issues that have not been updated in more than 4 months. |
Notes |
Issue History | |||
Date Modified | Username | Field | Change |
2014-08-29 13:11 | Vijay Pradeep | New Issue | |
2014-09-18 12:36 | Shootfast | Note Added: 0036825 | |
2014-11-28 23:17 | Rongcui Dong | Note Added: 0037312 | |
2014-12-04 11:41 | Vijay Pradeep | File Added: console_output_ubuntu_14_04_cmake_2_8_12_2.txt | |
2014-12-04 11:48 | Vijay Pradeep | Note Added: 0037382 | |
2014-12-04 15:06 | Rongcui Dong | Note Added: 0037388 | |
2014-12-04 15:13 | Brad King | Note Added: 0037389 | |
2014-12-04 15:13 | Brad King | Assigned To | => Brad King |
2014-12-04 15:13 | Brad King | Status | new => assigned |
2014-12-04 15:13 | Brad King | Target Version | => CMake 3.2 |
2014-12-08 09:02 | Brad King | Note Added: 0037404 | |
2014-12-12 11:22 | Brad King | Status | assigned => resolved |
2014-12-12 11:22 | Brad King | Resolution | open => fixed |
2014-12-12 11:22 | Brad King | Fixed in Version | => CMake 3.2 |
2014-12-12 12:12 | Vijay Pradeep | Note Added: 0037447 | |
2015-03-06 15:35 | Brad King | Note Added: 0038168 | |
2015-03-06 15:35 | Brad King | Status | resolved => assigned |
2015-03-06 15:35 | Brad King | Resolution | fixed => open |
2015-03-06 15:35 | Brad King | Fixed in Version | CMake 3.2 => |
2015-03-06 15:39 | Brad King | Note Added: 0038169 | |
2015-03-06 15:42 | Brad King | Note Added: 0038170 | |
2015-03-06 18:14 | Brad King | Note Edited: 0038170 | |
2015-03-06 20:00 | Brad King | Note Edited: 0038170 | |
2015-03-09 09:43 | Brad King | Status | assigned => resolved |
2015-03-09 09:43 | Brad King | Resolution | open => fixed |
2015-03-09 09:43 | Brad King | Fixed in Version | => CMake 3.2 |
2015-03-09 09:44 | Brad King | Fixed in Version | CMake 3.2 => CMake 3.2.1 |
2015-03-09 09:44 | Brad King | Target Version | CMake 3.2 => CMake 3.2.1 |
2015-11-02 09:13 | Robert Maynard | Note Added: 0039723 | |
2015-11-02 09:13 | Robert Maynard | Status | resolved => closed |
Issue History |
Copyright © 2000 - 2018 MantisBT Team |