View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0015434CMakeCMakepublic2015-03-06 10:382015-11-02 09:13
ReporterBen Boeckel 
Assigned ToNils Gladitz 
PrioritynormalSeverityminorReproducibilityhave not tried
StatusclosedResolutionfixed 
PlatformOSOS Version
Product VersionCMake 3.2 
Target VersionFixed in VersionCMake 3.3 
Summary0015434: Multiple add_custom_command with the same MAIN_DEPENDENCY causes duplicate rule invokations
DescriptionLatest report: https://bugzilla.redhat.com/show_bug.cgi?id=1199360 [^]

AFAIK, I've only heard of this with the Unix Makefiles generator. Minimal test case wanted.
TagsNo tags attached.
Attached Files

 Relationships
related to 0014550closedJames Bigler FindCUDA: source files shared between multiple targets results in linker using objects from both targets 

  Notes
(0038160)
Nils Gladitz (developer)
2015-03-06 10:46

Could the linked issue be related to http://public.kitware.com/pipermail/cmake-developers/2015-March/024634.html [^] instead?

I see multiple outputs.
(0038162)
Ben Boeckel (developer)
2015-03-06 11:41

Possibly. The case I heard about previously (I asked him to report here) had something along the lines of:

add_custom_command(OUTPUT a MAIN_DEPENDENCY dep ...)
add_custom_command(OUTPUT b MAIN_DEPENDENCY dep ...)
add_custom_target(tgt-a DEPENDS a)
add_custom_target(tgt-b DEPENDS b)

which, apparently, added some sort of dependency between a and b due to MAIN_DEPENDENCY.
(0038163)
Ben Boeckel (developer)
2015-03-06 11:42

That report was also in November probably with a release version of CMake (likely 3.0).
(0038164)
Brad King (manager)
2015-03-06 11:46

The add_custom_command documentation says that a given MAIN_DEPENDENCY can be used for at most one command:

 http://www.cmake.org/cmake/help/v3.2/command/add_custom_command.html [^]
(0038165)
Nils Gladitz (developer)
2015-03-06 11:50

I also had issues with MAIN_DEPENDENCY itself before (I linked 0014550) and the consensus was that FindCUDA.cmake might diagnose this.

Could CMake itself perhaps diagnose this instead?
E.g. new policy that makes it a fatal error when two commands reference the same MAIN_DEPENDENCY?
(0038166)
Brad King (manager)
2015-03-06 11:53

Re 0015434:0038165: Yes, having CMake diagnose it would be good. Make it a policy so that it warns now and can be an error later.
(0038180)
Nils Gladitz (developer)
2015-03-09 07:14

I pushed the "main_dependency_diagnostic" topic for review and merged it to next for testing.
(0038349)
Nils Gladitz (developer)
2015-03-27 09:39

Reusing the same MAIN_DEPENDENCY is now diagnosed by:

http://www.cmake.org/gitweb?p=cmake.git;a=commit;h=242c396656783b1b3d542b14bc62710a46a87518 [^]
(0039749)
Robert Maynard (manager)
2015-11-02 09:13

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

 Issue History
Date Modified Username Field Change
2015-03-06 10:38 Ben Boeckel New Issue
2015-03-06 10:46 Nils Gladitz Note Added: 0038160
2015-03-06 11:41 Ben Boeckel Note Added: 0038162
2015-03-06 11:42 Ben Boeckel Note Added: 0038163
2015-03-06 11:46 Brad King Note Added: 0038164
2015-03-06 11:47 Nils Gladitz Relationship added related to 0014550
2015-03-06 11:50 Nils Gladitz Note Added: 0038165
2015-03-06 11:53 Brad King Note Added: 0038166
2015-03-09 07:14 Nils Gladitz Note Added: 0038180
2015-03-27 09:39 Nils Gladitz Note Added: 0038349
2015-03-27 09:39 Nils Gladitz Status new => resolved
2015-03-27 09:39 Nils Gladitz Fixed in Version => CMake 3.3
2015-03-27 09:39 Nils Gladitz Resolution open => fixed
2015-03-27 09:39 Nils Gladitz Assigned To => Nils Gladitz
2015-11-02 09:13 Robert Maynard Note Added: 0039749
2015-11-02 09:13 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team