diff options
author | Gerald Combs <gerald@zing.org> | 2015-01-18 13:27:13 -0800 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2015-01-20 16:12:20 +0000 |
commit | 6e6a1291d0b36fe97d0f684e1abdfe546aaeae7f (patch) | |
tree | e441c514c057d4cadd74ae21ec6cc321b63ef285 /cmake/modules | |
parent | af3924a333aa8fc614ad45163751a614a9b9fc3d (diff) |
CMake: Set an output directory for plugins.
Redefine PLUGIN_DIR similar to DATAFILE_DIR and use it on all
platforms. Add WiresharkPlugin.cmake so that we can start defining common
macros for plugins/*/CMakeLists.txt. Load plugins in out-of-tree builds.
Change-Id: I8c1359ed3cf8a71788b8320ff89dfe2d3969def2
Reviewed-on: https://code.wireshark.org/review/6640
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'cmake/modules')
-rw-r--r-- | cmake/modules/WiresharkPlugin.cmake | 61 |
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() |