TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags
[wireshark-sm.git] / cmake / modules / WiresharkPlugin.cmake
bloba44f6e04b65c09b265a7373e460cf28c30493275
1 # Plugin convenience macros.
3 # Set information
4 macro(SET_MODULE_INFO _plugin _ver_major _ver_minor _ver_micro _ver_extra)
5         if(WIN32)
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)
20                 else()
21                         set(_plugin_rc_in ${CMAKE_SOURCE_DIR}/plugins/plugin.rc.in)
22                 endif()
23                 configure_file(${_plugin_rc_in} plugin.rc @ONLY)
24                 set(PLUGIN_RC_FILE ${CMAKE_CURRENT_BINARY_DIR}/plugin.rc)
25         endif()
27         set(PLUGIN_VERSION "${_ver_major}.${_ver_minor}.${_ver_micro}")
28         add_definitions(-DPLUGIN_VERSION=\"${PLUGIN_VERSION}\")
29 endmacro()
31 macro(ADD_WIRESHARK_PLUGIN_LIBRARY _plugin _subfolder)
32         add_library(${_plugin} MODULE
33                 ${PLUGIN_FILES}
34                 ${PLUGIN_RC_FILE}
35         )
37         target_include_directories(${_plugin} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
39         set_target_properties(${_plugin} PROPERTIES
40                 PREFIX ""
41                 LINK_FLAGS "${WS_LINK_FLAGS}"
42                 FOLDER "Plugins"
43         )
44         if(MSVC)
45                 set_target_properties(${_plugin} PROPERTIES LINK_FLAGS_DEBUG "${WS_MSVC_DEBUG_LINK_FLAGS}")
46         endif()
48         set_target_properties(${_plugin} PROPERTIES
49                 LIBRARY_OUTPUT_DIRECTORY ${PLUGIN_DIR}/${_subfolder}
50                 INSTALL_RPATH ""
51         )
53         add_dependencies(plugins ${_plugin})
54 endmacro()
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})
59 endmacro()
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}
66         )
67 endmacro()
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}
75 endmacro()