diff options
author | Brad King <brad.king@kitware.com> | 2013-02-25 18:11:55 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2013-02-25 18:11:55 (GMT) |
commit | 6e567cabea8df6f8fc8c401f4b9bfe2997c4399e (patch) | |
tree | de5b17ec60ffa8ae71e138819a0eae6edc9867f1 /Source | |
parent | 05e1b3c17d45320410ef8c7e080a33766ca63c2a (diff) | |
parent | 79568f95ab920158fdcb857c9b99592ad5300a4e (diff) | |
download | CMake-6e567cabea8df6f8fc8c401f4b9bfe2997c4399e.zip CMake-6e567cabea8df6f8fc8c401f4b9bfe2997c4399e.tar.gz CMake-6e567cabea8df6f8fc8c401f4b9bfe2997c4399e.tar.bz2 |
Merge topic 'fix-automoc-linker-language'
79568f9 automoc: Add source file to target early to set the linker language
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGlobalGenerator.cxx | 10 | ||||
-rw-r--r-- | Source/cmQtAutomoc.cxx | 27 | ||||
-rw-r--r-- | Source/cmQtAutomoc.h | 1 |
3 files changed, 26 insertions, 12 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 } diff --git a/Source/cmQtAutomoc.cxx b/Source/cmQtAutomoc.cxx index 4818f1b..10ce641 100644 --- a/Source/cmQtAutomoc.cxx +++ b/Source/cmQtAutomoc.cxx @@ -119,6 +119,22 @@ cmQtAutomoc::cmQtAutomoc() } } +void cmQtAutomoc::InitializeMocSourceFile(cmTarget* target) +{ + std::string automocTargetName = target->GetName(); + cmMakefile *makefile = target->GetMakefile(); + automocTargetName += "_automoc"; + std::string mocCppFile = makefile->GetCurrentOutputDirectory(); + mocCppFile += "/"; + mocCppFile += automocTargetName; + mocCppFile += ".cpp"; + cmSourceFile* mocCppSource = makefile->GetOrCreateSource(mocCppFile.c_str(), + true); + makefile->AppendProperty("ADDITIONAL_MAKE_CLEAN_FILES", + mocCppFile.c_str(), false); + + target->AddSourceFile(mocCppSource); +} void cmQtAutomoc::SetupAutomocTarget(cmTarget* target) { @@ -268,17 +284,6 @@ void cmQtAutomoc::SetupAutomocTarget(cmTarget* target) outputFile += "/AutomocInfo.cmake"; makefile->ConfigureFile(inputFile.c_str(), outputFile.c_str(), false, true, false); - - std::string mocCppFile = makefile->GetCurrentOutputDirectory(); - mocCppFile += "/"; - mocCppFile += automocTargetName; - mocCppFile += ".cpp"; - cmSourceFile* mocCppSource = makefile->GetOrCreateSource(mocCppFile.c_str(), - true); - target->AddSourceFile(mocCppSource); - - makefile->AppendProperty("ADDITIONAL_MAKE_CLEAN_FILES", - mocCppFile.c_str(), false); } diff --git a/Source/cmQtAutomoc.h b/Source/cmQtAutomoc.h index 69da80e..962e254 100644 --- a/Source/cmQtAutomoc.h +++ b/Source/cmQtAutomoc.h @@ -23,6 +23,7 @@ public: cmQtAutomoc(); bool Run(const char* targetDirectory); + void InitializeMocSourceFile(cmTarget* target); void SetupAutomocTarget(cmTarget* target); private: |