summaryrefslogtreecommitdiffstats
path: root/Source/cmQtAutoGenInitializer.cxx
diff options
context:
space:
mode:
authorAlexey Edelev <alexey.edelev@qt.io>2021-02-18 15:02:46 (GMT)
committerAlexey Edelev <alexey.edelev@qt.io>2021-02-23 12:46:40 (GMT)
commit1265c65b330c3ba25136c6fa75fc93945c4ebec2 (patch)
tree1584eae43e057e10178dd5e7b3f521a15ec4829f /Source/cmQtAutoGenInitializer.cxx
parent772c32831fa7b62fbb09fca7655d0b538926c5e4 (diff)
downloadCMake-1265c65b330c3ba25136c6fa75fc93945c4ebec2.zip
CMake-1265c65b330c3ba25136c6fa75fc93945c4ebec2.tar.gz
CMake-1265c65b330c3ba25136c6fa75fc93945c4ebec2.tar.bz2
AUTOUIC: Collect ui header files for Ninja generator
The '<user target>_autogen/timestamp' target supposed to generate ui header files using the 'uic'. Ninja must have information about these header files as a result of generating. The fix collects .ui files of the user target and generates a list of the ui headers that need to be added to the generating results of the '<user target>_autogen/timestamp' target. The case when the .ui files are not specified and collected by AUTOUIC from the include directives of the project source files is not covered in this patch. Fixes: #16776
Diffstat (limited to 'Source/cmQtAutoGenInitializer.cxx')
-rw-r--r--Source/cmQtAutoGenInitializer.cxx31
1 files changed, 31 insertions, 0 deletions
diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx
index bfe174c..1bcadaf 100644
--- a/Source/cmQtAutoGenInitializer.cxx
+++ b/Source/cmQtAutoGenInitializer.cxx
@@ -939,6 +939,30 @@ bool cmQtAutoGenInitializer::InitScanFiles()
if (!uicOpts.empty()) {
this->Uic.UiFiles.emplace_back(fullPath, cmExpandedList(uicOpts));
}
+
+ auto uiHeaderRelativePath = cmSystemTools::RelativePath(
+ this->LocalGen->GetCurrentSourceDirectory(),
+ cmSystemTools::GetFilenamePath(fullPath));
+
+ auto uiHeaderFilePath = cmStrCat(
+ '/', uiHeaderRelativePath, '/', "ui_"_s,
+ cmSystemTools::GetFilenameWithoutLastExtension(fullPath), ".h"_s);
+
+ ConfigString uiHeader;
+ uiHeader.Default =
+ cmStrCat(this->Dir.Build, "/include"_s, uiHeaderFilePath);
+ auto uiHeaderGenex = uiHeader.Default;
+ if (this->MultiConfig) {
+ uiHeaderGenex = cmStrCat(this->Dir.Build, "/include_$<CONFIG>"_s,
+ uiHeaderFilePath);
+ for (std::string const& cfg : this->ConfigsList) {
+ uiHeader.Config[cfg] = cmStrCat(this->Dir.Build, "/include_"_s,
+ cfg, uiHeaderFilePath);
+ }
+ }
+
+ this->Uic.UiHeaders.emplace_back(
+ std::make_pair(uiHeader, uiHeaderGenex));
} else {
// Register skipped .ui file
this->Uic.SkipUi.insert(fullPath);
@@ -1092,6 +1116,13 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
autogenByproducts.push_back(this->Moc.CompilationFileGenex);
}
+ if (this->Uic.Enabled) {
+ for (const auto& file : this->Uic.UiHeaders) {
+ this->AddGeneratedSource(file.first, this->Uic);
+ autogenByproducts.push_back(file.second);
+ }
+ }
+
// Compose target comment
std::string autogenComment;
{