CTK 0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
ctkMacroGeneratePluginResourceFile.cmake
Go to the documentation of this file.
1#
2# Depends on:
3# CTK/CMake/ctkMacroParseArguments.cmake
4#
5
6#! \ingroup CMakeUtilities
7macro(ctkMacroGeneratePluginResourceFile QRC_SRCS)
8
9 CtkMacroParseArguments(MY
10 "NAME;PREFIX;RESOURCES;BINARY_RESOURCES"
11 ""
12 ${ARGN}
13 )
14
15 set(_qrc_filepath "${CMAKE_CURRENT_BINARY_DIR}/${MY_NAME}")
16
17 set(_qrc_content
18"<!DOCTYPE RCC><RCC version=\"1.0\">
19<qresource prefix=\"/${MY_PREFIX}\">
20")
21
22 if(MY_RESOURCES)
23 foreach(_resource_file ${MY_RESOURCES})
24 configure_file("${CMAKE_CURRENT_SOURCE_DIR}/${_resource_file}" "${CMAKE_CURRENT_BINARY_DIR}/${_resource_file}" COPYONLY)
25 set(_qrc_content "${_qrc_content}<file>${_resource_file}</file>
26")
27 endforeach()
28 endif()
29
30 if(MY_BINARY_RESOURCES)
31 foreach(_resource_file ${MY_BINARY_RESOURCES})
32 set(_qrc_content "${_qrc_content}<file>${_resource_file}</file>
33")
34 endforeach()
35 endif()
36
37 set(_qrc_content "${_qrc_content}</qresource>
38</RCC>
39")
40 configure_file("${CTK_CMAKE_DIR}/plugin_resources_cached.qrc.in" "${_qrc_filepath}" @ONLY)
41
42 if (CTK_QT_VERSION VERSION_GREATER "4")
43 QT5_ADD_RESOURCES(${QRC_SRCS} ${_qrc_filepath})
44 else()
45 QT4_ADD_RESOURCES(${QRC_SRCS} ${_qrc_filepath})
46 endif()
47
48endmacro()