Browse Source

Autogen: Fix a bug in setting the UIC source group

If the relative path to a UI file was empty then the source group for the corresponding autogen header file would not apply because of a double slash in the path.
Duncan Barber 4 years ago
parent
commit
e8ddc1e268
1 changed files with 7 additions and 1 deletions
  1. 7 1
      Source/cmQtAutoGenInitializer.cxx

+ 7 - 1
Source/cmQtAutoGenInitializer.cxx

@@ -943,8 +943,14 @@ bool cmQtAutoGenInitializer::InitScanFiles()
             this->LocalGen->GetCurrentSourceDirectory(),
             cmSystemTools::GetFilenamePath(fullPath));
 
+          // Avoid creating a path containing adjacent slashes
+          if (!uiHeaderRelativePath.empty() &&
+              uiHeaderRelativePath.back() != '/') {
+            uiHeaderRelativePath += '/';
+          }
+
           auto uiHeaderFilePath = cmStrCat(
-            '/', uiHeaderRelativePath, '/', "ui_"_s,
+            '/', uiHeaderRelativePath, "ui_"_s,
             cmSystemTools::GetFilenameWithoutLastExtension(fullPath), ".h"_s);
 
           ConfigString uiHeader;