summaryrefslogtreecommitdiffstats
path: root/Source/cmQtAutoGeneratorInitializer.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmQtAutoGeneratorInitializer.cxx')
-rw-r--r--Source/cmQtAutoGeneratorInitializer.cxx17
1 files changed, 15 insertions, 2 deletions
diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx
index 9766a5a..bc75c59 100644
--- a/Source/cmQtAutoGeneratorInitializer.cxx
+++ b/Source/cmQtAutoGeneratorInitializer.cxx
@@ -658,8 +658,8 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenSources(
{
if (target->GetPropertyAsBool("AUTOMOC")) {
cmMakefile* makefile = target->Target->GetMakefile();
- std::string mocCppFile = GetAutogenTargetBuildDir(target);
- mocCppFile += "moc_compilation.cpp";
+ const std::string mocCppFile =
+ GetAutogenTargetBuildDir(target) + "moc_compilation.cpp";
makefile->GetOrCreateSource(mocCppFile, true);
makefile->AppendProperty("ADDITIONAL_MAKE_CLEAN_FILES", mocCppFile.c_str(),
false);
@@ -675,6 +675,7 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
// Create a custom target for running generators at buildtime
const std::string autogenTargetName = GetAutogenTargetName(target);
+ const std::string autogenBuildDir = GetAutogenTargetBuildDir(target);
const std::string workingDirectory =
cmSystemTools::CollapseFullPath("", makefile->GetCurrentBinaryDirectory());
@@ -683,6 +684,18 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
qtMajorVersion = makefile->GetSafeDefinition("Qt5Core_VERSION_MAJOR");
}
+ // Create autogen target build directory
+ cmSystemTools::MakeDirectory(autogenBuildDir);
+
+ // Create autogen target includes directory and
+ // add it to the origin target INCLUDE_DIRECTORIES
+ if (target->GetPropertyAsBool("AUTOMOC") ||
+ target->GetPropertyAsBool("AUTOUIC")) {
+ const std::string incsDir = autogenBuildDir + "include";
+ cmSystemTools::MakeDirectory(incsDir);
+ target->AddIncludeDirectory(incsDir, true);
+ }
+
// Initialize autogen target dependencies
std::vector<std::string> depends;
if (const char* autogenDepends =