1 # Plugin convenience macros.
4 macro(SET_MODULE_INFO _plugin _ver_major _ver_minor _ver_micro _ver_extra)
5 # Create the Windows .rc file for the plugin.
6 # The values come from several files in the source, I can't see how to reuse them
8 set(PACKAGE ${_plugin})
9 set(MODULE_VERSION_MAJOR ${_ver_major})
10 set(MODULE_VERSION_MINOR ${_ver_minor})
11 set(MODULE_VERSION_MICRO ${_ver_micro})
12 set(MODULE_VERSION_EXTRA ${_ver_extra})
13 set(MODULE_VERSION "${MODULE_VERSION_MAJOR}.${MODULE_VERSION_MINOR}.${MODULE_VERSION_MICRO}.${MODULE_VERSION_EXTRA}")
14 set(RC_MODULE_VERSION "${MODULE_VERSION_MAJOR},${MODULE_VERSION_MINOR},${MODULE_VERSION_MICRO},${MODULE_VERSION_EXTRA}")
16 # This info is from Makefile.am
17 set(PLUGIN_NAME ${PACKAGE})
19 set(MSVC_VARIANT "${CMAKE_GENERATOR}")
21 # The rc.in requires a plain VERSION variable
22 set(VERSION ${PROJECT_VERSION})
24 # Create the plugin.rc file from the template
25 configure_file(plugin.rc.in plugin.rc @ONLY)
28 macro(ADD_PLUGIN_LIBRARY _plugin)
29 add_library(${_plugin} ${LINK_MODE_MODULE}
31 ${CMAKE_CURRENT_BINARY_DIR}/plugin.rc
34 set_target_properties(${_plugin} PROPERTIES
36 LINK_FLAGS "${WS_LINK_FLAGS}"
40 # LIBRARY_OUTPUT_DIRECTORY alone appears to be sufficient.
41 set_target_properties(${_plugin} PROPERTIES
42 #ARCHIVE_OUTPUT_DIRECTORY ${PLUGIN_DIR}
43 LIBRARY_OUTPUT_DIRECTORY ${PLUGIN_DIR}
44 #RUNTIME_OUTPUT_DIRECTORY ${PLUGIN_DIR}
47 # Try to force output to ${PLUGIN_DIR} without the configuration
48 # type appended. Needed for CPack on Windows.
49 foreach(_config_type ${CMAKE_CONFIGURATION_TYPES})
50 string(TOUPPER ${_config_type} _config_upper)
51 set_target_properties(${_plugin} PROPERTIES
52 LIBRARY_OUTPUT_DIRECTORY_${_config_upper} ${CMAKE_BINARY_DIR}/run/${_config_type}/${PLUGIN_VERSION_DIR}
56 target_link_libraries(${_plugin} epan)
57 add_dependencies(plugins ${_plugin})