summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2014-03-25 00:16:49 (GMT)
committerStephen Kelly <steveire@gmail.com>2014-03-25 00:16:49 (GMT)
commit261acd91093ba5f2bf79f38a9632887ab2dd5f1c (patch)
treecdd8d71264c8dad88a103098947e418243db8fa9
parent6a85d624a8d5e48080785d5aacd48badc4d41d99 (diff)
downloadCMake-261acd91093ba5f2bf79f38a9632887ab2dd5f1c.zip
CMake-261acd91093ba5f2bf79f38a9632887ab2dd5f1c.tar.gz
CMake-261acd91093ba5f2bf79f38a9632887ab2dd5f1c.tar.bz2
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.
-rw-r--r--Source/cmQtAutoGenerators.cxx2
-rw-r--r--Tests/QtAutogen/CMakeLists.txt2
-rw-r--r--Tests/QtAutogen/resourcetester.cpp2
-rw-r--r--Tests/QtAutogen/second_resource.qrc5
4 files changed, 10 insertions, 1 deletions
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 $<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")
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 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource>
+ <file>main.cpp</file>
+</qresource>
+</RCC>