summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalGenerator.cxx
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2013-02-20 16:06:45 (GMT)
committerBrad King <brad.king@kitware.com>2013-02-22 13:29:33 (GMT)
commit79568f95ab920158fdcb857c9b99592ad5300a4e (patch)
treed728b4e87615b8a6b14cf9bb70bd135a119954fb /Source/cmGlobalGenerator.cxx
parent4515b09731856dc2713c567a48fec1374b317ece (diff)
downloadCMake-79568f95ab920158fdcb857c9b99592ad5300a4e.zip
CMake-79568f95ab920158fdcb857c9b99592ad5300a4e.tar.gz
CMake-79568f95ab920158fdcb857c9b99592ad5300a4e.tar.bz2
automoc: Add source file to target early to set the linker language
Previously, GetIncludeDirectories was called before calling target->AddSourceFile(mocCppSource). Since commit a1c4905f (Use the link information as a source of compile definitions and includes., 2013-02-12), the include directories are determined by the link information. Valid link information requires that the linker language can be determined, which depends on the source files languages and the dependent targets languages. In the case of the no_link_languages target in the unit test, there are no dependencies and the additional source file no_link_languages_automoc.cpp is added to the target at generate-time. That file can be used to determine the linker language, but it must be added to the target before calling GetIncludeDirectories.
Diffstat (limited to 'Source/cmGlobalGenerator.cxx')
-rw-r--r--Source/cmGlobalGenerator.cxx10
1 files changed, 9 insertions, 1 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index ba29589..f2defbb 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1067,6 +1067,8 @@ bool cmGlobalGenerator::CheckTargets()
void cmGlobalGenerator::CreateAutomocTargets()
{
#ifdef CMAKE_BUILD_WITH_CMAKE
+ typedef std::vector<std::pair<cmQtAutomoc, cmTarget*> > Automocs;
+ Automocs automocs;
for(unsigned int i=0; i < this->LocalGenerators.size(); ++i)
{
cmTargets& targets =
@@ -1084,11 +1086,17 @@ void cmGlobalGenerator::CreateAutomocTargets()
if(target.GetPropertyAsBool("AUTOMOC") && !target.IsImported())
{
cmQtAutomoc automoc;
- automoc.SetupAutomocTarget(&target);
+ automoc.InitializeMocSourceFile(&target);
+ automocs.push_back(std::make_pair(automoc, &target));
}
}
}
}
+ for (Automocs::iterator it = automocs.begin(); it != automocs.end();
+ ++it)
+ {
+ it->first.SetupAutomocTarget(it->second);
+ }
#endif
}