View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0014633CMakeCMakepublic2013-12-05 21:242016-06-10 14:31
ReporterSean Patrick Santos 
Assigned ToKitware Robot 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0014633: There should be a standard way to communicate that a source is generated to parent/sibling directories.
DescriptionI'm referring to something that's described on the wiki here: [^]

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.)
TagsNo tags attached.
Attached Files


Kitware Robot (administrator)
2016-06-10 14:29

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.

 Issue History
Date Modified Username Field Change
2013-12-05 21:24 Sean Patrick Santos New Issue
2016-06-10 14:29 Kitware Robot Note Added: 0042443
2016-06-10 14:29 Kitware Robot Status new => resolved
2016-06-10 14:29 Kitware Robot Resolution open => moved
2016-06-10 14:29 Kitware Robot Assigned To => Kitware Robot
2016-06-10 14:31 Kitware Robot Status resolved => closed

Copyright © 2000 - 2018 MantisBT Team