summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-06-29 12:43:13 +0000
committerKitware Robot <kwrobot@kitware.com>2022-06-29 08:43:27 -0400
commit18c0ff66b240a73c337e364f4766e8c6665fb013 (patch)
treee8a1c9d13e1820af9fd61ce4edd29ad2d2f07c1d
parente9213013e605b963d016b132e1488eca5847b29a (diff)
parent10668f26c9f058aacc2cef057f542f22fcd6eb71 (diff)
downloadcmake-18c0ff66b240a73c337e364f4766e8c6665fb013.tar.gz
Merge topic 'fix-23523' into release-3.24
10668f26c9 AUTOUIC: Fix internal paths of generated ui_foo.h files Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Merge-request: !7419
-rw-r--r--Source/cmQtAutoGenInitializer.cxx28
1 files changed, 16 insertions, 12 deletions
diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx
index 40f3ab58d1..1514a8aced 100644
--- a/Source/cmQtAutoGenInitializer.cxx
+++ b/Source/cmQtAutoGenInitializer.cxx
@@ -909,6 +909,7 @@ bool cmQtAutoGenInitializer::InitScanFiles()
// The reason is that their file names might be discovered from source files
// at generation time.
if (this->MocOrUicEnabled()) {
+ std::unordered_set<std::string> addedFiles;
for (const auto& sf : this->Makefile->GetSourceFiles()) {
// sf->GetExtension() is only valid after sf->ResolveFullPath() ...
// Since we're iterating over source files that might be not in the
@@ -950,25 +951,28 @@ bool cmQtAutoGenInitializer::InitScanFiles()
cmExpandedList(uicOpts));
}
- auto uiHeaderRelativePath = cmSystemTools::RelativePath(
- this->LocalGen->GetCurrentSourceDirectory(),
- cmSystemTools::GetFilenamePath(fullPath));
+ auto uiHeaderFileName = cmStrCat(
+ "ui_"_s, cmSystemTools::GetFilenameWithoutLastExtension(fullPath),
+ ".h"_s);
- // Avoid creating a path containing adjacent slashes
- if (!uiHeaderRelativePath.empty() &&
- uiHeaderRelativePath.back() != '/') {
- uiHeaderRelativePath += '/';
+ // .ui files with the same base name will conflict. Yield an error.
+ {
+ auto insertResult = addedFiles.insert(uiHeaderFileName);
+ if (!insertResult.second) {
+ this->Makefile->IssueMessage(
+ MessageType::FATAL_ERROR,
+ cmStrCat("More than one .ui file with the name "_s,
+ cmSystemTools::GetFilenameName(fullPath),
+ " was found in the sources for target "_s,
+ this->GenTarget->GetName(), "."));
+ }
}
- auto uiHeaderFilePath = cmStrCat(
- '/', uiHeaderRelativePath, "ui_"_s,
- cmSystemTools::GetFilenameWithoutLastExtension(fullPath), ".h"_s);
-
ConfigString uiHeader;
std::string uiHeaderGenex;
this->ConfigFileNamesAndGenex(
uiHeader, uiHeaderGenex, cmStrCat(this->Dir.Build, "/include"_s),
- uiHeaderFilePath);
+ cmStrCat("/"_s, uiHeaderFileName));
this->Uic.UiHeaders.emplace_back(
std::make_pair(uiHeader, uiHeaderGenex));