summaryrefslogtreecommitdiffstats
path: root/Tests/QtAutogen/autorcc_depends
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2014-09-17 00:42:30 (GMT)
committerStephen Kelly <steveire@gmail.com>2014-10-24 17:45:27 (GMT)
commit6e1c359fe9bee71c421a671108176d47fb415d93 (patch)
tree7672d870bac30b8ede0e201558155e5107cdb9b9 /Tests/QtAutogen/autorcc_depends
parenta29953180c21ba0d56fb236eb58bafd40ae68961 (diff)
downloadCMake-6e1c359fe9bee71c421a671108176d47fb415d93.zip
CMake-6e1c359fe9bee71c421a671108176d47fb415d93.tar.gz
CMake-6e1c359fe9bee71c421a671108176d47fb415d93.tar.bz2
QtAutogen: Regenerate qrc files if their input changes (#15074)
Get dependencies from the output of ``rcc --list`` if using Qt 5. Otherwise process the file in the same way as the qt4_add_resources macro. This does not work for RCC files which are generated. The cmake_autogen build step is implemented as a PRE_BUILD step of the target currently if possible, rather than a standalone custom target. This is to keep the number of (synthesized) custom targets that appear in the UI low, but in some cases it is necessary to fall back to a full custom target. Fall back to a full custom target for the VS builds if autorcc is used.
Diffstat (limited to 'Tests/QtAutogen/autorcc_depends')
-rw-r--r--Tests/QtAutogen/autorcc_depends/CMakeLists.txt24
-rw-r--r--Tests/QtAutogen/autorcc_depends/res1.qrc5
-rw-r--r--Tests/QtAutogen/autorcc_depends/res1_input.txt1
-rw-r--r--Tests/QtAutogen/autorcc_depends/test_res1.cpp5
4 files changed, 35 insertions, 0 deletions
diff --git a/Tests/QtAutogen/autorcc_depends/CMakeLists.txt b/Tests/QtAutogen/autorcc_depends/CMakeLists.txt
new file mode 100644
index 0000000..afd95bc
--- /dev/null
+++ b/Tests/QtAutogen/autorcc_depends/CMakeLists.txt
@@ -0,0 +1,24 @@
+cmake_minimum_required(VERSION 2.8)
+project(autorcc_depends)
+
+set(CMAKE_AUTORCC ON)
+
+if (QT_TEST_VERSION STREQUAL 4)
+ find_package(Qt4 REQUIRED)
+ set(QT_CORE_TARGET Qt4::QtCore)
+else()
+ if (NOT QT_TEST_VERSION STREQUAL 5)
+ message(SEND_ERROR "Invalid Qt version specified.")
+ endif()
+
+ find_package(Qt5Core REQUIRED)
+ set(QT_CORE_TARGET Qt5::Core)
+endif()
+
+add_executable(test_res1
+ test_res1.cpp
+ res1.qrc
+)
+target_link_libraries(test_res1 ${QT_CORE_TARGET})
+add_custom_command(TARGET test_res1 POST_BUILD COMMAND
+ ${CMAKE_COMMAND} -E echo "$<TARGET_FILE:test_res1>" > info_file.txt)
diff --git a/Tests/QtAutogen/autorcc_depends/res1.qrc b/Tests/QtAutogen/autorcc_depends/res1.qrc
new file mode 100644
index 0000000..cfea618
--- /dev/null
+++ b/Tests/QtAutogen/autorcc_depends/res1.qrc
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/">
+ <file>res1_input.txt</file>
+ </qresource>
+</RCC>
diff --git a/Tests/QtAutogen/autorcc_depends/res1_input.txt b/Tests/QtAutogen/autorcc_depends/res1_input.txt
new file mode 100644
index 0000000..da62762
--- /dev/null
+++ b/Tests/QtAutogen/autorcc_depends/res1_input.txt
@@ -0,0 +1 @@
+Res1 input.
diff --git a/Tests/QtAutogen/autorcc_depends/test_res1.cpp b/Tests/QtAutogen/autorcc_depends/test_res1.cpp
new file mode 100644
index 0000000..766b775
--- /dev/null
+++ b/Tests/QtAutogen/autorcc_depends/test_res1.cpp
@@ -0,0 +1,5 @@
+
+int main()
+{
+ return 0;
+}