summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/Autogen/AutoRccExecutableConfig.cmake
blob: a0e9ce9c90a9cde0df90092a867e18f28c2b0978 (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
enable_language(CXX)

set(CMAKE_CXX_STANDARD 11)
find_package(Qt${with_qt_version} REQUIRED COMPONENTS Core Widgets Gui)

if(NOT TARGET Qt${with_qt_version}::rcc)
  message(FATAL_ERROR "Qt${with_qt_version}::rcc not found")
endif()

add_library(dummy STATIC example.cpp data.qrc)
target_link_libraries(dummy Qt${with_qt_version}::Core
                            Qt${with_qt_version}::Widgets
                            Qt${with_qt_version}::Gui)

get_target_property(rcc_location Qt${with_qt_version}::rcc IMPORTED_LOCATION)
set_target_properties(dummy PROPERTIES AUTORCC_OPTIONS "EXE_PATH=${rcc_location}")

add_executable(myrcc $<$<CONFIG:Debug>:exe_debug.cpp>
                     $<$<CONFIG:Release>:exe_release.cpp>
                     $<$<CONFIG:RelWithDebInfo>:exe_relwithdebinfo.cpp>
)

set_target_properties(dummy PROPERTIES AUTORCC_EXECUTABLE $<TARGET_FILE:myrcc>
                                       AUTORCC ON)