1 # Plugin convenience macros.
4 macro(SET_MODULE_INFO _plugin _ver_major _ver_minor _ver_micro _ver_extra)
6 # Create the Windows .rc file for the plugin.
7 set(MODULE_NAME ${_plugin})
8 set(MODULE_VERSION_MAJOR ${_ver_major})
9 set(MODULE_VERSION_MINOR ${_ver_minor})
10 set(MODULE_VERSION_MICRO ${_ver_micro})
11 set(MODULE_VERSION_EXTRA ${_ver_extra})
12 set(MODULE_VERSION "${MODULE_VERSION_MAJOR}.${MODULE_VERSION_MINOR}.${MODULE_VERSION_MICRO}.${MODULE_VERSION_EXTRA}")
13 set(RC_MODULE_VERSION "${MODULE_VERSION_MAJOR},${MODULE_VERSION_MINOR},${MODULE_VERSION_MICRO},${MODULE_VERSION_EXTRA}")
15 set(MSVC_VARIANT "${CMAKE_GENERATOR}")
17 # Create the plugin.rc file from the template
18 if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/plugin.rc.in)
19 set(_plugin_rc_in ${CMAKE_CURRENT_SOURCE_DIR}/plugin.rc.in)
21 set(_plugin_rc_in ${CMAKE_SOURCE_DIR}/plugins/plugin.rc.in)
23 configure_file(${_plugin_rc_in} plugin.rc @ONLY)
24 set(PLUGIN_RC_FILE ${CMAKE_CURRENT_BINARY_DIR}/plugin.rc)
27 set(PLUGIN_VERSION "${_ver_major}.${_ver_minor}.${_ver_micro}")
28 add_definitions(-DPLUGIN_VERSION=\"${PLUGIN_VERSION}\")
31 macro(ADD_WIRESHARK_PLUGIN_LIBRARY _plugin _subfolder)
32 add_library(${_plugin} MODULE
37 target_include_directories(${_plugin} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
39 set_target_properties(${_plugin} PROPERTIES
41 LINK_FLAGS "${WS_LINK_FLAGS}"
45 set_target_properties(${_plugin} PROPERTIES LINK_FLAGS_DEBUG "${WS_MSVC_DEBUG_LINK_FLAGS}")
48 set_target_properties(${_plugin} PROPERTIES
49 LIBRARY_OUTPUT_DIRECTORY ${PLUGIN_DIR}/${_subfolder}
53 add_dependencies(plugins ${_plugin})
56 macro(ADD_PLUGIN_LIBRARY _plugin _subfolder)
57 message(WARNING "${CMAKE_PARENT_LIST_FILE}: add_plugin_library is deprecated. Use add_wireshark_plugin_library instead.")
58 ADD_WIRESHARK_PLUGIN_LIBRARY(${_plugin} ${_subfolder})
61 macro(ADD_STRATOSHARK_PLUGIN_LIBRARY _plugin _subfolder)
62 ADD_WIRESHARK_PLUGIN_LIBRARY(${_plugin} ${_subfolder})
64 set_target_properties(${_plugin} PROPERTIES
65 LIBRARY_OUTPUT_DIRECTORY ${STRATOSHARK_PLUGIN_DIR}/${_subfolder}
69 macro(INSTALL_PLUGIN _plugin _subfolder)
70 install(TARGETS ${_plugin}
71 LIBRARY DESTINATION ${PLUGIN_INSTALL_VERSION_LIBDIR}/${_subfolder} NAMELINK_SKIP
72 RUNTIME DESTINATION ${PLUGIN_INSTALL_VERSION_LIBDIR}
73 ARCHIVE DESTINATION ${PLUGIN_INSTALL_VERSION_LIBDIR}