diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index 7b11b61cf..a6e6af7e4 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -1791,8 +1791,8 @@ void cmQtAutoGenerators::ParseForUic(const std::string& absFilename, std::string::size_type matchOffset = 0; - const std::string absPath = cmsys::SystemTools::GetFilenamePath( - cmsys::SystemTools::GetRealPath(absFilename.c_str())) + '/'; + const std::string realName = + cmsys::SystemTools::GetRealPath(absFilename.c_str()); matchOffset = 0; if ((strstr(contentsString.c_str(), "ui_") != NULL) @@ -1809,7 +1809,7 @@ void cmQtAutoGenerators::ParseForUic(const std::string& absFilename, // finding the correct header, so we need to remove the ui_ part basename = basename.substr(3); - includedUis[absPath] = basename; + includedUis[realName] = basename; matchOffset += uiIncludeRegExp.end(); } while(uiIncludeRegExp.find(contentsString.c_str() + matchOffset)); @@ -1965,7 +1965,7 @@ bool cmQtAutoGenerators::GenerateMoc(const std::string& sourceFile, return false; } -bool cmQtAutoGenerators::GenerateUi(const std::string& path, +bool cmQtAutoGenerators::GenerateUi(const std::string& realName, const std::string& uiFileName) { if (!cmsys::SystemTools::FileExists(this->Builddir.c_str(), false)) @@ -1973,6 +1973,9 @@ bool cmQtAutoGenerators::GenerateUi(const std::string& path, cmsys::SystemTools::MakeDirectory(this->Builddir.c_str()); } + const std::string path = cmsys::SystemTools::GetFilenamePath( + realName.c_str()) + '/'; + std::string ui_output_file = "ui_" + uiFileName + ".h"; std::string ui_input_file = path + uiFileName + ".ui"; @@ -2079,6 +2082,8 @@ bool cmQtAutoGenerators::GenerateQrc() } } + command.push_back("-name"); + command.push_back(basename); command.push_back("-o"); command.push_back(rcc_output_file); command.push_back(*si); diff --git a/Source/cmQtAutoGenerators.h b/Source/cmQtAutoGenerators.h index a593dd5da..800379501 100644 --- a/Source/cmQtAutoGenerators.h +++ b/Source/cmQtAutoGenerators.h @@ -48,7 +48,7 @@ private: bool RunAutogen(cmMakefile* makefile); bool GenerateMoc(const std::string& sourceFile, const std::string& mocFileName); - bool GenerateUi(const std::string& path, const std::string& uiFileName); + bool GenerateUi(const std::string& realName, const std::string& uiFileName); bool GenerateQrc(); void ParseCppFile(const std::string& absFilename, const std::vector& headerExtensions, diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt index 0821b454d..d2116aa92 100644 --- a/Tests/QtAutogen/CMakeLists.txt +++ b/Tests/QtAutogen/CMakeLists.txt @@ -64,9 +64,9 @@ add_custom_command( DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/myotherinterface.h.in" ) -add_executable(QtAutogen main.cpp calwidget.cpp foo.cpp blub.cpp bar.cpp abc.cpp +add_executable(QtAutogen main.cpp calwidget.cpp second_widget.cpp foo.cpp blub.cpp bar.cpp abc.cpp xyz.cpp yaf.cpp gadget.cpp $ - test.qrc resourcetester.cpp generated.cpp + test.qrc second_resource.qrc resourcetester.cpp generated.cpp ) set_property(TARGET QtAutogen APPEND PROPERTY AUTOGEN_TARGET_DEPENDS generate_moc_input "${CMAKE_CURRENT_BINARY_DIR}/myotherinterface.h") diff --git a/Tests/QtAutogen/resourcetester.cpp b/Tests/QtAutogen/resourcetester.cpp index 43314e1f8..0c64d80af 100644 --- a/Tests/QtAutogen/resourcetester.cpp +++ b/Tests/QtAutogen/resourcetester.cpp @@ -16,6 +16,8 @@ void ResourceTester::doTest() { if (!QFile::exists(":/CMakeLists.txt")) qApp->exit(EXIT_FAILURE); + if (!QFile::exists(":/main.cpp")) + qApp->exit(EXIT_FAILURE); QTimer::singleShot(0, qApp, SLOT(quit())); } diff --git a/Tests/QtAutogen/second_resource.qrc b/Tests/QtAutogen/second_resource.qrc new file mode 100644 index 000000000..27bfb143b --- /dev/null +++ b/Tests/QtAutogen/second_resource.qrc @@ -0,0 +1,5 @@ + + + main.cpp + + diff --git a/Tests/QtAutogen/second_widget.cpp b/Tests/QtAutogen/second_widget.cpp new file mode 100644 index 000000000..65ba9627c --- /dev/null +++ b/Tests/QtAutogen/second_widget.cpp @@ -0,0 +1,14 @@ + +#include "second_widget.h" +#include "ui_second_widget.h" + +SecondWidget::SecondWidget(QWidget *parent) + : QWidget(parent), ui(new Ui::SecondWidget) +{ + ui->setupUi(this); +} + +SecondWidget::~SecondWidget() +{ + delete ui; +} diff --git a/Tests/QtAutogen/second_widget.h b/Tests/QtAutogen/second_widget.h new file mode 100644 index 000000000..fe4d175f7 --- /dev/null +++ b/Tests/QtAutogen/second_widget.h @@ -0,0 +1,19 @@ + +#include + +namespace Ui +{ +class SecondWidget; +} + +class SecondWidget : public QWidget +{ + Q_OBJECT +public: + explicit SecondWidget(QWidget *parent = 0); + + ~SecondWidget(); + +private: + Ui::SecondWidget* ui; +}; diff --git a/Tests/QtAutogen/second_widget.ui b/Tests/QtAutogen/second_widget.ui new file mode 100644 index 000000000..4effa589c --- /dev/null +++ b/Tests/QtAutogen/second_widget.ui @@ -0,0 +1,32 @@ + + + SecondWidget + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + 80 + 20 + 94 + 24 + + + + PushButton + + + + + +