diff options
author | Stephen Kelly <steveire@gmail.com> | 2013-02-20 16:06:45 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2013-02-22 13:29:33 (GMT) |
commit | 79568f95ab920158fdcb857c9b99592ad5300a4e (patch) | |
tree | d728b4e87615b8a6b14cf9bb70bd135a119954fb /Source/cmQtAutomoc.cxx | |
parent | 4515b09731856dc2713c567a48fec1374b317ece (diff) | |
download | CMake-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/cmQtAutomoc.cxx')
-rw-r--r-- | Source/cmQtAutomoc.cxx | 27 |
1 files changed, 16 insertions, 11 deletions
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); } |