aboutsummaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake')
-rw-r--r--cmake/modules/WiresharkPlugin.cmake61
1 files changed, 61 insertions, 0 deletions
diff --git a/cmake/modules/WiresharkPlugin.cmake b/cmake/modules/WiresharkPlugin.cmake
new file mode 100644
index 0000000000..e5c69fca97
--- /dev/null
+++ b/cmake/modules/WiresharkPlugin.cmake
@@ -0,0 +1,61 @@
+# Plugin convenience macros.
+
+# Set information similar to moduleinfo.nmake
+macro(SET_MODULE_INFO _plugin _ver_major _ver_minor _ver_micro _ver_extra)
+ # Create the Windows .rc file for the plugin.
+ # The values come from several files in the source, I can't see how to reuse them
+
+ # This info is from moduleinfo.nmake
+ set(PACKAGE ${_plugin})
+ set(MODULE_VERSION_MAJOR ${_ver_major})
+ set(MODULE_VERSION_MINOR ${_ver_minor})
+ set(MODULE_VERSION_MICRO ${_ver_micro})
+ set(MODULE_VERSION_EXTRA ${_ver_extra})
+ set(MODULE_VERSION "${MODULE_VERSION_MAJOR}.${MODULE_VERSION_MINOR}.${MODULE_VERSION_MICRO}.${MODULE_VERSION_EXTRA}")
+ set(RC_MODULE_VERSION "${MODULE_VERSION_MAJOR},${MODULE_VERSION_MINOR},${MODULE_VERSION_MICRO},${MODULE_VERSION_EXTRA}")
+
+ # This info is from Makefile.common
+ set(PLUGIN_NAME ${PACKAGE})
+
+ # This info is from config.nmake
+ set(MSVC_VARIANT "${CMAKE_GENERATOR}")
+
+ # The rc.in requires a plain VERSION variable
+ set(VERSION ${PROJECT_VERSION})
+
+ # Create the plugin.rc file from the template
+ configure_file(plugin.rc.in plugin.rc @ONLY)
+endmacro()
+
+macro(ADD_PLUGIN_LIBRARY _plugin)
+ add_library(${_plugin} ${LINK_MODE_MODULE}
+ ${PLUGIN_FILES}
+ ${CMAKE_CURRENT_BINARY_DIR}/plugin.rc
+ )
+
+ set_target_properties(${_plugin} PROPERTIES
+ PREFIX ""
+ LINK_FLAGS "${WS_LINK_FLAGS}"
+ FOLDER "Plugins"
+ )
+
+ # LIBRARY_OUTPUT_DIRECTORY alone appears to be sufficient.
+ set_target_properties(${_plugin} PROPERTIES
+ #ARCHIVE_OUTPUT_DIRECTORY ${PLUGIN_DIR}
+ LIBRARY_OUTPUT_DIRECTORY ${PLUGIN_DIR}
+ #RUNTIME_OUTPUT_DIRECTORY ${PLUGIN_DIR}
+ )
+
+ # Try to force output to ${PLUGIN_DIR} without the configuration
+ # type appended.
+ foreach(_config_type ${CMAKE_CONFIGURATION_TYPES})
+ string(TOUPPER ${_config_type} _config_upper)
+ set_target_properties(${_plugin} PROPERTIES
+ #ARCHIVE_OUTPUT_DIRECTORY_${_config_upper} ${PLUGIN_DIR}
+ LIBRARY_OUTPUT_DIRECTORY_${_config_upper} ${PLUGIN_DIR}
+ #RUNTIME_OUTPUT_DIRECTORY_${_config_upper} ${PLUGIN_DIR}
+ )
+ endforeach()
+
+ target_link_libraries(${_plugin} epan)
+endmacro()