summaryrefslogtreecommitdiffstats
path: root/Source/cmQtAutoGeneratorInitializer.cxx
diff options
context:
space:
mode:
authorSebastian Holtermann <sebholt@xwmw.org>2016-12-02 16:20:25 (GMT)
committerBrad King <brad.king@kitware.com>2016-12-07 13:24:03 (GMT)
commit8f437f3c35ae13c147e0d022a84774750d4a0a7a (patch)
tree5358d6cc24d8e735a12d53230502233adb03ff8c /Source/cmQtAutoGeneratorInitializer.cxx
parent360c3427117312548358fddce906a346f17b8f5f (diff)
downloadCMake-8f437f3c35ae13c147e0d022a84774750d4a0a7a.zip
CMake-8f437f3c35ae13c147e0d022a84774750d4a0a7a.tar.gz
CMake-8f437f3c35ae13c147e0d022a84774750d4a0a7a.tar.bz2
QtAutogen: Add moc compilation file to autogen target byproducts
Closes: #16389
Diffstat (limited to 'Source/cmQtAutoGeneratorInitializer.cxx')
-rw-r--r--Source/cmQtAutoGeneratorInitializer.cxx22
1 files changed, 12 insertions, 10 deletions
diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx
index 76fb8e5..3a46ab0 100644
--- a/Source/cmQtAutoGeneratorInitializer.cxx
+++ b/Source/cmQtAutoGeneratorInitializer.cxx
@@ -679,22 +679,27 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
const std::string workingDirectory =
cmSystemTools::CollapseFullPath("", makefile->GetCurrentBinaryDirectory());
const std::string qtMajorVersion = GetQtMajorVersion(target);
+ std::vector<std::string> autogenOutputFiles;
- // Create autogen target build directory
+ // Create autogen target build directory and add it to the clean files
cmSystemTools::MakeDirectory(autogenBuildDir);
- // Remove entire autogen build directory on clean
makefile->AppendProperty("ADDITIONAL_MAKE_CLEAN_FILES",
autogenBuildDir.c_str(), false);
- // Create autogen target includes directory and
- // add it to the origin target INCLUDE_DIRECTORIES
if (target->GetPropertyAsBool("AUTOMOC") ||
target->GetPropertyAsBool("AUTOUIC")) {
+ // Create autogen target includes directory and
+ // add it to the origin target INCLUDE_DIRECTORIES
const std::string incsDir = autogenBuildDir + "include";
cmSystemTools::MakeDirectory(incsDir);
target->AddIncludeDirectory(incsDir, true);
}
+ if (target->GetPropertyAsBool("AUTOMOC")) {
+ // Register moc compilation file as generated
+ autogenOutputFiles.push_back ( autogenBuildDir + "moc_compilation.cpp" );
+ }
+
// Initialize autogen target dependencies
std::vector<std::string> depends;
if (const char* autogenDepends =
@@ -765,7 +770,6 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
}
#endif
- std::vector<std::string> rcc_output;
bool const isNinja = lg->GetGlobalGenerator()->GetName() == "Ninja";
if (isNinja
#if defined(_WIN32) && !defined(__CYGWIN__)
@@ -792,10 +796,8 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
rccOutputFile +=
cmsys::SystemTools::GetFilenameWithoutLastExtension(absFile);
rccOutputFile += ".cpp";
- rcc_output.push_back(rccOutputFile);
- // Create output directory
- cmSystemTools::MakeDirectory(
- cmsys::SystemTools::GetFilenamePath(rccOutputFile));
+ // Register rcc output file as generated
+ autogenOutputFiles.push_back(rccOutputFile);
}
if (!cmSystemTools::IsOn(sf->GetPropertyForUser("GENERATED"))) {
RccListInputs(qtMajorVersion, sf, target, depends);
@@ -829,7 +831,7 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
{
cmTarget* autogenTarget = makefile->AddUtilityCommand(
autogenTargetName, true, workingDirectory.c_str(),
- /*byproducts=*/rcc_output, depends, commandLines, false,
+ /*byproducts=*/autogenOutputFiles, depends, commandLines, false,
autogenComment.c_str());
cmGeneratorTarget* gt = new cmGeneratorTarget(autogenTarget, lg);