From 261acd91093ba5f2bf79f38a9632887ab2dd5f1c Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 25 Mar 2014 01:16:49 +0100 Subject: QtAutogen: Use the basename for resource files. The rcc tool generates a cpp file with a symbol called qInitResources or called qInitResources_${name}, if the name is passed. The qInitResources symbol clashes if multiple qrc files are used in one target. Always pass the name to ensure that the symbol is unique. This is also the behavior of the qtx_add_resource macros. --- Source/cmQtAutoGenerators.cxx | 2 ++ Tests/QtAutogen/CMakeLists.txt | 2 +- Tests/QtAutogen/resourcetester.cpp | 2 ++ Tests/QtAutogen/second_resource.qrc | 5 +++++ 4 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 Tests/QtAutogen/second_resource.qrc diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index 2c5dd45..fcc898a 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -2074,6 +2074,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/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt index 0821b45..cf80f41 100644 --- a/Tests/QtAutogen/CMakeLists.txt +++ b/Tests/QtAutogen/CMakeLists.txt @@ -66,7 +66,7 @@ add_custom_command( add_executable(QtAutogen main.cpp calwidget.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 43314e1..0c64d80 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 0000000..27bfb14 --- /dev/null +++ b/Tests/QtAutogen/second_resource.qrc @@ -0,0 +1,5 @@ + + + main.cpp + + -- cgit v0.12