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.
This commit is contained in:
Stephen Kelly 2014-03-25 01:16:49 +01:00
parent 6a85d624a8
commit 261acd9109
4 changed files with 10 additions and 1 deletions

View File

@ -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);

View File

@ -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 $<TARGET_OBJECTS:privateSlot>
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")

View File

@ -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()));
}

View File

@ -0,0 +1,5 @@
<!DOCTYPE RCC><RCC version="1.0">
<qresource>
<file>main.cpp</file>
</qresource>
</RCC>