Don't link wiretap plugins with libwireshark.

Make the second argument to add_plugin_library() and install_plugin() be
a plugin type - currently, either "epan" or "wiretap" - and, based on
its value, set the subfolder and required libraries in
add_plugin_library() and the subfolder in install_plugin().  If it's not
one of the known values, fail.

Change-Id: I556863772c59330d2854fbb4673f544f8359dcd2
Reviewed-on: https://code.wireshark.org/review/25579
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
Guy Harris 2018-02-03 12:25:24 -08:00
parent d8551c4247
commit d5f52cfaf5
1 changed files with 21 additions and 3 deletions

View File

@ -28,7 +28,17 @@ macro(SET_MODULE_INFO _plugin _ver_major _ver_minor _ver_micro _ver_extra)
add_definitions(-DPLUGIN_VERSION=\"${PLUGIN_VERSION}\")
endmacro()
macro(ADD_PLUGIN_LIBRARY _plugin _subfolder)
macro(ADD_PLUGIN_LIBRARY _plugin _plugin_type)
if(${_plugin_type} STREQUAL "epan")
set(_subfolder "epan")
set(_required_libraries "epan")
elseif(${_plugin_type} STREQUAL "wiretap")
set(_subfolder "wiretap")
set(_required_libraries "wiretap")
else()
message(FATAL_ERROR "add_plugin_library called with invalid plugin type ${_plugin_type}")
endif()
add_library(${_plugin} MODULE
${PLUGIN_FILES}
${PLUGIN_RC_FILE}
@ -53,11 +63,19 @@ macro(ADD_PLUGIN_LIBRARY _plugin _subfolder)
)
endforeach()
target_link_libraries(${_plugin} epan)
target_link_libraries(${_plugin} ${_required_libraries})
add_dependencies(plugins ${_plugin})
endmacro()
macro(INSTALL_PLUGIN _plugin _subfolder)
macro(INSTALL_PLUGIN _plugin _plugin_type)
if(${_plugin_type} STREQUAL "epan")
set(_subfolder "epan")
elseif(${_plugin_type} STREQUAL "wiretap")
set(_subfolder "wiretap")
else()
message(FATAL_ERROR "install_plugin called with invalid plugin type ${_plugin_type}")
endif()
install(TARGETS ${_plugin}
LIBRARY DESTINATION ${PLUGIN_INSTALL_LIBDIR}/${_subfolder} NAMELINK_SKIP
RUNTIME DESTINATION ${PLUGIN_INSTALL_LIBDIR}