[cmake-developers] [CMake 0014633]: There should be a standard way to communicate that a source is generated to parent/sibling directories.

Mantis Bug Tracker mantis at public.kitware.com
Thu Dec 5 21:24:40 EST 2013


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=14633 
====================================================================== 
Reported By:                Sean Patrick Santos
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   14633
Category:                   CMake
Reproducibility:            N/A
Severity:                   feature
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2013-12-05 21:24 EST
Last Modified:              2013-12-05 21:24 EST
====================================================================== 
Summary:                    There should be a standard way to communicate that a
source is generated to parent/sibling directories.
Description: 
I'm referring to something that's described on the wiki here:

http://www.cmake.org/Wiki/CMake_FAQ#How_can_I_add_a_dependency_to_a_source_file_which_is_generated_in_a_subdirectory.3F

The method described there is a bit weak when source files from the same
directory need to be added to targets in multiple directories. In that case,
each target has to "know" which source files are generated code, even though it
should be possible, in principle, for CMake to figure this out on its own. If a
source file is replaced with a generated version (or vice versa), every
directory that uses that file has to be updated with this info.

There are two possible changes that would really help here.

To me, the ideal solution would be for add_custom_command calls to be visible
when adding a target in a different directory. That is, it would be nice if
using a generated source in another directory "just worked" with no source file
properties or custom targets required.

Alternatively, source file properties could have scope beyond the current
directory (which seems to be a more intuitive behavior anyway). That way,
instead of a directory having to "know" that a file in a different directory was
generated, it could just loop over files, and then perform an add_dependencies
call on each file that had the GENERATED property set. (I will probably
implement something similar to this strategy in my own project, by using
variables rather than a property, but it will be rather non-standard and less
straightforward than if I could check the GENERATED property.)

(P.S.: In my case, the targets are test executables that each need a different
subset of the source files, so I cannot use an intermediate library, even an
object library, to simplify things. Each source file really does have to be
mentioned in one way or another in each of the directories that builds an
executable against it.)
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2013-12-05 21:24 Sean Patrick SantosNew Issue                                   

======================================================================




More information about the cmake-developers mailing list