diff options
| author | Brad King <brad.king@kitware.com> | 2022-07-25 15:55:04 (GMT) |
|---|---|---|
| committer | Kitware Robot <kwrobot@kitware.com> | 2022-07-25 15:55:12 (GMT) |
| commit | 6336ee80d3a24b73f4fcf30ef091da6b8324a6c0 (patch) | |
| tree | c8071fd063dcca8ab8146bcfe37437303d1b04ff | |
| parent | e305fec8ad15420d4d79a1543d7a495a4f1f769a (diff) | |
| parent | 778aaf6fdc10fdf961b3cfbbfe770adf2a3f2873 (diff) | |
| download | CMake-6336ee80d3a24b73f4fcf30ef091da6b8324a6c0.zip CMake-6336ee80d3a24b73f4fcf30ef091da6b8324a6c0.tar.gz CMake-6336ee80d3a24b73f4fcf30ef091da6b8324a6c0.tar.bz2 | |
Merge topic 'revert-ui-check' into release-3.24
778aaf6fdc AUTOUIC: Revert "Fix internal paths of generated ui_foo.h files"
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !7498
| -rw-r--r-- | Source/cmQtAutoGenInitializer.cxx | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index 1514a8a..40f3ab5 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -909,7 +909,6 @@ 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 @@ -951,28 +950,25 @@ bool cmQtAutoGenInitializer::InitScanFiles() cmExpandedList(uicOpts)); } - auto uiHeaderFileName = cmStrCat( - "ui_"_s, cmSystemTools::GetFilenameWithoutLastExtension(fullPath), - ".h"_s); + auto uiHeaderRelativePath = cmSystemTools::RelativePath( + this->LocalGen->GetCurrentSourceDirectory(), + cmSystemTools::GetFilenamePath(fullPath)); - // .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(), ".")); - } + // Avoid creating a path containing adjacent slashes + if (!uiHeaderRelativePath.empty() && + uiHeaderRelativePath.back() != '/') { + uiHeaderRelativePath += '/'; } + 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), - cmStrCat("/"_s, uiHeaderFileName)); + uiHeaderFilePath); this->Uic.UiHeaders.emplace_back( std::make_pair(uiHeader, uiHeaderGenex)); |
