34 lines
1.4 KiB
CMake
Raw Normal View History

2018-04-23 21:13:27 +02:00
cmake_minimum_required(VERSION 3.10)
project(RccDepends)
2019-11-11 23:01:05 +01:00
include("../../AutogenCoreTest.cmake")
2018-01-26 17:06:56 +01:00
# Enable AUTORCC for all targets
set(CMAKE_AUTORCC ON)
# Initial resource files setup
configure_file(resPlain/input.txt.in resPlain/input.txt COPYONLY)
configure_file(resPlain/input.txt.in resPlain/inputAdded.txt COPYONLY)
configure_file(resGen/input.txt.in resGen/input.txt COPYONLY)
configure_file(resGen/input.txt.in resGen/inputAdded.txt COPYONLY)
# Generated qrc file with dependency
2018-04-23 21:13:27 +02:00
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/resGen.qrc
2018-01-26 17:06:56 +01:00
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/resGen.qrc.in
COMMAND ${CMAKE_COMMAND} -E sleep 2
2018-04-23 21:13:27 +02:00
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/resGen.qrc.in ${CMAKE_CURRENT_BINARY_DIR}/resGen.qrc
)
2018-01-26 17:06:56 +01:00
# Target that uses a plain .qrc file
add_executable(rccDependsPlain main.cpp ${CMAKE_CURRENT_BINARY_DIR}/resPlain.qrc)
2018-04-23 21:13:27 +02:00
target_link_libraries(rccDependsPlain ${QT_QTCORE_TARGET})
2018-01-26 17:06:56 +01:00
add_custom_command(TARGET rccDependsPlain POST_BUILD COMMAND
2018-04-23 21:13:27 +02:00
${CMAKE_COMMAND} -E echo "$<TARGET_FILE:rccDependsPlain>" > targetPlain.txt
)
2018-01-26 17:06:56 +01:00
# Target that uses a GENERATED .qrc file
add_executable(rccDependsGen main.cpp ${CMAKE_CURRENT_BINARY_DIR}/resGen.qrc )
2018-04-23 21:13:27 +02:00
target_link_libraries(rccDependsGen ${QT_QTCORE_TARGET})
2018-01-26 17:06:56 +01:00
add_custom_command(TARGET rccDependsGen POST_BUILD COMMAND
2018-04-23 21:13:27 +02:00
${CMAKE_COMMAND} -E echo "$<TARGET_FILE:rccDependsGen>" > targetGen.txt
)