3 # CTK/CMake/ctkMacroParseArguments.cmake
6 #! \ingroup CMakeUtilities
7 function(ctkFunctionGeneratePluginManifest QRC_SRCS)
9 CtkMacroParseArguments(MY
10 "ACTIVATIONPOLICY;CATEGORY;CONTACT_ADDRESS;COPYRIGHT;DESCRIPTION;DOC_URL;ICON;LICENSE;NAME;REQUIRE_PLUGIN;SYMBOLIC_NAME;VENDOR;VERSION;CUSTOM_HEADERS"
16 if(NOT DEFINED MY_SYMBOLIC_NAME)
17 message(FATAL_ERROR "SYMBOLIC_NAME is mandatory")
20 set(_manifest_content "Plugin-SymbolicName: ${MY_SYMBOLIC_NAME}")
22 if(DEFINED MY_ACTIVATIONPOLICY)
23 string(TOLOWER "${MY_ACTIVATIONPOLICY}" _activation_policy)
24 if(_activation_policy STREQUAL "eager")
25 set(_manifest_content "${_manifest_content}\nPlugin-ActivationPolicy: eager")
27 message(FATAL_ERROR "ACTIVATIONPOLICY is set to '${MY_ACTIVATIONPOLICY}', which is not supported")
31 if(DEFINED MY_CATEGORY)
32 set(_manifest_content "${_manifest_content}\nPlugin-Category: ${MY_CATEGORY}")
35 if(DEFINED MY_CONTACT_ADDRESS)
36 set(_manifest_content "${_manifest_content}\nPlugin-ContactAddress: ${MY_CONTACT_ADDRESS}")
39 if(DEFINED MY_COPYRIGHT)
40 set(_manifest_content "${_manifest_content}\nPlugin-Copyright: ${MY_COPYRIGHT}")
43 if(DEFINED MY_DESCRIPTION)
44 set(_manifest_content "${_manifest_content}\nPlugin-Description: ${MY_DESCRIPTION}")
47 if(DEFINED MY_DOC_URL)
48 set(_manifest_content "${_manifest_content}\nPlugin-DocURL: ${MY_DOC_URL}")
52 set(_manifest_content "${_manifest_content}\nPlugin-Icon: ${MY_ICON}")
55 if(DEFINED MY_LICENSE)
56 set(_manifest_content "${_manifest_content}\nPlugin-License: ${MY_LICENSE}")
60 set(_manifest_content "${_manifest_content}\nPlugin-Name: ${MY_NAME}")
63 if(DEFINED MY_REQUIRE_PLUGIN)
64 string(REPLACE ";" "," require_plugin "${MY_REQUIRE_PLUGIN}")
65 set(_manifest_content "${_manifest_content}\nRequire-Plugin: ${require_plugin}")
69 set(_manifest_content "${_manifest_content}\nPlugin-Vendor: ${MY_VENDOR}")
72 if(DEFINED MY_VERSION)
73 set(_manifest_content "${_manifest_content}\nPlugin-Version: ${MY_VERSION}")
76 if(DEFINED MY_CUSTOM_HEADERS)
77 set(_manifest_content "${_manifest_content}\n")
78 foreach(_custom_header ${MY_CUSTOM_HEADERS})
79 set(_manifest_content "${_manifest_content}\n${_custom_header}: ${${_custom_header}}")
83 set(_manifest_filename "MANIFEST.MF")
84 set(_manifest_filepath "${CMAKE_CURRENT_BINARY_DIR}/${_manifest_filename}")
85 string(REPLACE "." "_" _symbolic_name ${MY_SYMBOLIC_NAME})
86 set(_manifest_qrc_filepath "${CMAKE_CURRENT_BINARY_DIR}/${_symbolic_name}_manifest.qrc")
88 set(_manifest_qrc_content
89 "<!DOCTYPE RCC><RCC version=\"1.0\">
90 <qresource prefix=\"/${MY_SYMBOLIC_NAME}/META-INF\">
91 <file>${_manifest_filename}</file>
96 configure_file("${CTK_CMAKE_DIR}/MANIFEST.MF.in" "${_manifest_filepath}" @ONLY)
97 configure_file("${CTK_CMAKE_DIR}/plugin_manifest.qrc.in" "${_manifest_qrc_filepath}" @ONLY)
99 if (CTK_QT_VERSION VERSION_GREATER "4")
100 QT5_ADD_RESOURCES(_qrc_src ${_manifest_qrc_filepath})
102 QT4_ADD_RESOURCES(_qrc_src ${_manifest_qrc_filepath})
105 set(${QRC_SRCS} ${${QRC_SRCS}} ${_qrc_src} PARENT_SCOPE)