MantisBT - CMake
View Issue Details
0002172CMakeCMakepublic2005-08-19 14:192016-06-10 14:30
Chris Green 
Brad King 
lowfeaturealways
closedmoved 
 
 
0002172: Want access to C/C++ depends scanner from custom command
I'd like to be able to do "deep" dependency chacking for a custom command.
No tags attached.
related to 0005952closed Clinton Stimpson Deleting a file previously referred to by a qws file breaks the build 
Issue History
2008-03-20 18:01Clinton StimpsonRelationship addedrelated to 0005952
2008-03-20 18:08Brad KingNote Added: 0010875
2012-08-13 10:36Brad KingStatusassigned => backlog
2012-08-13 10:36Brad KingNote Added: 0030483
2014-11-24 13:35Ben RobinsonNote Added: 0037268
2016-06-10 14:27Kitware RobotNote Added: 0041298
2016-06-10 14:27Kitware RobotStatusbacklog => resolved
2016-06-10 14:27Kitware RobotResolutionopen => moved
2016-06-10 14:30Kitware RobotStatusresolved => closed

Notes
(0002956)
Brad King   
2005-08-24 19:09   
One way to do this is to add a DEPENDS_SCANNER option to ADD_CUSTOM_COMMAND:

ADD_CUSTOM_COMMAND(
  OUTPUT myoutput.txt
  COMMAND mycmd myinput.txt myoutput.txt
  DEPENDS_SCANNER mydep myinput.txt
  )

This should be straightforward to implement for the Makefile generator: When CMake scans the dependencies of the target in which myoutput.txt is used it will run the given command line to actually do the scanning. The command will have to display dependencies to standard output or put them in some standard file. Then the CMake scanner will parse this output and use it to write dependencies into the proper part of the generated Makefile.

This could be very tricky to implement for project file generators. The feature effectively can change the dependencies during the build, especially if the input to custom dependency scanning is itself a generated file. We may need a hack such as that in GCCXML_CREATE_XML_FILE mentioned in bug 0001731.

NOTE: Bugs 0001731 and 0001740 will be solved with this feature.
(0004515)
James Bigler   
2006-07-20 13:23   
I'm still struggling with the SWIG dependecies (header files change, but my interface is not regenerated). Is the GCCXML_CREATE_XML_FILE the only way to do this?
(0010875)
Brad King   
2008-03-20 18:08   
CMake in CVS (and in the upcoming 2.6 release) supports an "IMPLICIT_DEPENDS" option in add_custom_command:

         add_custom_command(OUTPUT output1 [output2 ...]
                            COMMAND command1 [ARGS] [args1...]
                            [COMMAND command2 [ARGS] [args2...] ...]
                            [MAIN_DEPENDENCY depend]
                            [DEPENDS [depends...]]
                            [IMPLICIT_DEPENDS <lang1> depend1 ...]
                            [WORKING_DIRECTORY dir]
                            [COMMENT comment] [VERBATIM] [APPEND])


...


       The IMPLICIT_DEPENDS option requests scanning of implicit dependencies
       of an input file. The language given specifies the programming
       language whose corresponding dependency scanner should be used.
       Currently only C and CXX language scanners are supported.
       Dependencies discovered from the scanning are added to those of the
       custom command at build time. Note that the IMPLICIT_DEPENDS option
       is currently supported only for Makefile generators and will be
       ignored by other generators.
(0030483)
Brad King   
2012-08-13 10:36   
Sending issues I'm not actively working on to the backlog to await someone with time for them.

If an issue you care about is sent to the backlog when you feel it should have been addressed in a different manner, please bring it up on the CMake mailing list for discussion. Sign up for the mailing list here, if you're not already on it:

 http://www.cmake.org/mailman/listinfo/cmake [^]

It's easy to re-activate a bug here if you can find a CMake developer or contributor who has the bandwidth to take it on.
(0037268)
Ben Robinson   
2014-11-24 13:35   
I am attempting to convert a large SCONS based project to CMAKE. This project contains *.idl, *.sdl, and *.cdl files which include each-other, and therefore depend upon each-other. Of course, they produce *.cpp and *.h output files in an add_custom_command step. CMake is able to automatically manage the *.cpp -> *.Xdl dependencies, but not the *.Xdl -> *.Xdl dependencies.

It would elegantly solve my problem to add DEPENDS_SCANNER option to the custom command, where I could give the shell command to parse the *.Xdl files and generate their dependencies, in a format CMake could parse.
(0041298)
Kitware Robot   
2016-06-10 14:27   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.