blob: de98573d78c8e1dfcb804a550ca05306b8e3f8e4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
cmake_minimum_required(VERSION 3.7)
project(rccDepends)
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()
configure_file(res/input1.txt.in res1/input.txt @ONLY)
configure_file(res/input2.txt.in res2/input.txt @ONLY)
# Configure time generated qrc file
configure_file(res1.qrc.in res1.qrc @ONLY)
# Dependency generated qrc file
add_custom_command(OUTPUT res2.qrc
COMMAND ${CMAKE_COMMAND} -E sleep 3
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res2.qrc.in ${CMAKE_CURRENT_BINARY_DIR}/res2.qrc
)
add_executable(rccDepends
main.cpp
${CMAKE_CURRENT_BINARY_DIR}/res1.qrc
${CMAKE_CURRENT_BINARY_DIR}/res2.qrc
)
target_link_libraries(rccDepends ${QT_CORE_TARGET})
add_custom_command(TARGET rccDepends POST_BUILD COMMAND
${CMAKE_COMMAND} -E echo "$<TARGET_FILE:rccDepends>" > target1.txt)
|