View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0013493CMakeCMakepublic2012-08-27 09:132012-10-24 17:28
ReporterStephen Kelly 
Assigned ToAlex Neundorf 
PrioritynormalSeverityminorReproducibilityhave not tried
StatusclosedResolutionfixed 
PlatformOSOS Version
Product VersionCMake 2.8.10 
Target VersionCMake 2.8.10Fixed in VersionCMake 2.8.10 
Summary0013493: CMake AUTOMOC does not read target properties when generating moc info file.
DescriptionIn the cmQtAutomoc file, the property INCLUDE_DIRECTORIES for example is read from the makefile, not from the target. It bypasses the logic in cmTarget::GetIncludeDirectories. The GetIncludeDirectories method should be used instead.

This becomes more relevant in Qt 5 because plugin building is based on moc generating code by reading a json file specified in a macro. (see Q_PLUGIN_METADATA in http://doc-snapshot.qt-project.org/5.0/plugins-howto.html [^])

The json file must be in one of the include directories. If include_directories is used, it currently works, but if set_property(TARGET ...) is used it does not work.

Similarly, COMPILE_DEFINITIONS should be taken from the target too.
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0030781)
Alex Neundorf (developer)
2012-08-27 16:10

Like this ? http://cmake.org/gitweb?p=stage/cmake.git;a=shortlog;h=refs/heads/AutomocUseTargetProperties [^]
(0030785)
Stephen Kelly (developer)
2012-08-28 03:08

The target->GetProperty("INCLUDE_DIRECTORIES"); seems to work currently, but will not work when include_directories can contain generator expressions. The code in question runs at generate-time. Why do you not want to use target->GetIncludeDirectories() as all other generators do?

I tested the target->GetProperty("COMPILE_DEFINITIONS"); change and it seems to work, but I can't figure out how. COMPILE_DEFINITIONS does not 'chain', and I can't find any code that initializes the target property from the Makefile, as is done for INCLUDE_DIRECTORIES. How does that work?

The COMPILE_DEFINITIONS change has the same problem with regard to future generator expressions, but there is not really any better API for that yet as there is for GetIncludeDirectories (though there is cmLocalGenerator::AppendDefines which could be made static and would enforce uniqueness).

Additionally I notice that the COMPILE_DEFINITIONS_${CONFIG} variables are not handled with Automoc, as they are with other generators. It probably makes sense to fix this in the same branch to do more like what, eg, the Ninja generator does in cmNinjaTargetGenerator::ComputeDefines().
(0030789)
Alex Neundorf (developer)
2012-08-28 16:20

No problem, I can use GetIncludeDirectories(), it's just that when I looked at the (current) code, the only thing it does over the plain GetProperty("INCLUDE_DIRECTORIES") is to remove duplicates and turn it into a vector, which I have to turn back into a string then, so I thought it's easier and has the same effect as directly getting the property.
But if you think it's better, I can use GetIncludeDirectories().
(0030793)
Stephen Kelly (developer)
2012-08-29 05:18

Ok, cool. Any idea about how the target->GetProperty("COMPILE_DEFINITIONS"); seems to get the COMPILE_DEFINITIONS from the makefile too? Any response to the configuration specific COMPILE_DEFINITIONS?
(0030929)
Alex Neundorf (developer)
2012-09-05 16:01

The include dirs should now be handled correctly in the AutomocUseTargetProperties branch on stage.
I still need to have a look at the compile definitions.
(0031064)
Alex Neundorf (developer)
2012-09-19 11:46

Merged the AutomocUseTargetProperties branch into next.

 Issue History
Date Modified Username Field Change
2012-08-27 09:13 Stephen Kelly New Issue
2012-08-27 09:13 Stephen Kelly Status new => assigned
2012-08-27 09:13 Stephen Kelly Assigned To => Alex Neundorf
2012-08-27 16:10 Alex Neundorf Note Added: 0030781
2012-08-28 03:08 Stephen Kelly Note Added: 0030785
2012-08-28 16:20 Alex Neundorf Note Added: 0030789
2012-08-29 05:18 Stephen Kelly Note Added: 0030793
2012-09-05 16:01 Alex Neundorf Note Added: 0030929
2012-09-19 11:46 Alex Neundorf Note Added: 0031064
2012-09-19 11:46 Alex Neundorf Status assigned => closed
2012-09-19 11:46 Alex Neundorf Resolution open => fixed
2012-09-19 11:46 Alex Neundorf Description Updated
2012-10-24 17:28 David Cole Fixed in Version => CMake 2.8.10
2012-10-24 17:28 David Cole Target Version => CMake 2.8.10


Copyright © 2000 - 2018 MantisBT Team