| 1 |
cmake_minimum_required(VERSION 3.16) |
| 2 |
project(RccDepends) |
| 3 |
include("../../AutogenCoreTest.cmake") |
| 4 |
|
| 5 |
# Enable AUTORCC for all targets |
| 6 |
set(CMAKE_AUTORCC ON) |
| 7 |
|
| 8 |
# Initial resource files setup |
| 9 |
configure_file(resPlain/input.txt.in resPlain/input.txt COPYONLY) |
| 10 |
configure_file(resPlain/input.txt.in resPlain/inputAdded.txt COPYONLY) |
| 11 |
configure_file(resGen/input.txt.in resGen/input.txt COPYONLY) |
| 12 |
configure_file(resGen/input.txt.in resGen/inputAdded.txt COPYONLY) |
| 13 |
|
| 14 |
# Generated qrc file with dependency |
| 15 |
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/resGen.qrc |
| 16 |
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/resGen.qrc.in |
| 17 |
COMMAND ${CMAKE_COMMAND} -E sleep 2 |
| 18 |
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/resGen.qrc.in ${CMAKE_CURRENT_BINARY_DIR}/resGen.qrc |
| 19 |
) |
| 20 |
|
| 21 |
# Target that uses a plain .qrc file |
| 22 |
add_executable(rccDependsPlain main.cpp ${CMAKE_CURRENT_BINARY_DIR}/resPlain.qrc) |
| 23 |
target_link_libraries(rccDependsPlain ${QT_QTCORE_TARGET}) |
| 24 |
add_custom_command(TARGET rccDependsPlain POST_BUILD COMMAND |
| 25 |
${CMAKE_COMMAND} -E echo "$<TARGET_FILE:rccDependsPlain>" > targetPlain.txt |
| 26 |
) |
| 27 |
|
| 28 |
# Target that uses a GENERATED .qrc file |
| 29 |
add_executable(rccDependsGen main.cpp ${CMAKE_CURRENT_BINARY_DIR}/resGen.qrc ) |
| 30 |
target_link_libraries(rccDependsGen ${QT_QTCORE_TARGET}) |
| 31 |
add_custom_command(TARGET rccDependsGen POST_BUILD COMMAND |
| 32 |
${CMAKE_COMMAND} -E echo "$<TARGET_FILE:rccDependsGen>" > targetGen.txt |
| 33 |
) |