From 121abba1a237fba2c9a9377ced3ca7a47b5eef25 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Sat, 3 Feb 2018 17:22:09 -0800 Subject: [PATCH] Have individual plugin CMakeLists.txt files add library dependencies. This removes any knowledge of plugin types from cmake/modules/WiresharkPlugin.cmake, so that it doesn't have to be changed if we add a new plugin type. Revert to the second argument to add_plugin_library() and install_plugin() being the subfolder. Change-Id: I668ab90b28c73a8b12ca8e3e906b8de2f9395ca5 Reviewed-on: https://code.wireshark.org/review/25585 Petri-Dish: Guy Harris Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris --- cmake/modules/WiresharkPlugin.cmake | 23 ++--------------------- plugins/epan/docsis/CMakeLists.txt | 2 ++ plugins/epan/ethercat/CMakeLists.txt | 2 ++ plugins/epan/gryphon/CMakeLists.txt | 2 ++ plugins/epan/irda/CMakeLists.txt | 2 ++ plugins/epan/mate/CMakeLists.txt | 2 ++ plugins/epan/opcua/CMakeLists.txt | 2 ++ plugins/epan/pluginifdemo/CMakeLists.txt | 2 +- plugins/epan/profinet/CMakeLists.txt | 2 ++ plugins/epan/stats_tree/CMakeLists.txt | 2 ++ plugins/epan/transum/CMakeLists.txt | 2 ++ plugins/epan/unistim/CMakeLists.txt | 2 ++ plugins/epan/wimax/CMakeLists.txt | 2 ++ plugins/epan/wimaxasncp/CMakeLists.txt | 2 ++ plugins/epan/wimaxmacphy/CMakeLists.txt | 2 ++ plugins/wiretap/usbdump/CMakeLists.txt | 2 ++ 16 files changed, 31 insertions(+), 22 deletions(-) diff --git a/cmake/modules/WiresharkPlugin.cmake b/cmake/modules/WiresharkPlugin.cmake index 9be5a49b35..75b62a55f9 100644 --- a/cmake/modules/WiresharkPlugin.cmake +++ b/cmake/modules/WiresharkPlugin.cmake @@ -28,17 +28,7 @@ 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 _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() - +macro(ADD_PLUGIN_LIBRARY _plugin _subfolder) add_library(${_plugin} MODULE ${PLUGIN_FILES} ${PLUGIN_RC_FILE} @@ -63,19 +53,10 @@ macro(ADD_PLUGIN_LIBRARY _plugin _plugin_type) ) endforeach() - target_link_libraries(${_plugin} ${_required_libraries}) add_dependencies(plugins ${_plugin}) endmacro() -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() - +macro(INSTALL_PLUGIN _plugin _subfolder) install(TARGETS ${_plugin} LIBRARY DESTINATION ${PLUGIN_INSTALL_LIBDIR}/${_subfolder} NAMELINK_SKIP RUNTIME DESTINATION ${PLUGIN_INSTALL_LIBDIR} diff --git a/plugins/epan/docsis/CMakeLists.txt b/plugins/epan/docsis/CMakeLists.txt index 190a6491eb..63aad88ad3 100644 --- a/plugins/epan/docsis/CMakeLists.txt +++ b/plugins/epan/docsis/CMakeLists.txt @@ -56,6 +56,8 @@ register_plugin_files(plugin.c add_plugin_library(docsis epan) +target_link_libraries(docsis epan) + install_plugin(docsis epan) file(GLOB DISSECTOR_HEADERS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "*.h") diff --git a/plugins/epan/ethercat/CMakeLists.txt b/plugins/epan/ethercat/CMakeLists.txt index 6c227b46ec..6dc62fdf9d 100644 --- a/plugins/epan/ethercat/CMakeLists.txt +++ b/plugins/epan/ethercat/CMakeLists.txt @@ -58,6 +58,8 @@ register_plugin_files(plugin.c add_plugin_library(ethercat epan) +target_link_libraries(ethercat epan) + install_plugin(ethercat epan) file(GLOB DISSECTOR_HEADERS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "*.h") diff --git a/plugins/epan/gryphon/CMakeLists.txt b/plugins/epan/gryphon/CMakeLists.txt index d6ecb662f4..3e19f43eaf 100644 --- a/plugins/epan/gryphon/CMakeLists.txt +++ b/plugins/epan/gryphon/CMakeLists.txt @@ -52,6 +52,8 @@ register_plugin_files(plugin.c add_plugin_library(gryphon epan) +target_link_libraries(gryphon epan) + install_plugin(gryphon epan) file(GLOB DISSECTOR_HEADERS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "*.h") diff --git a/plugins/epan/irda/CMakeLists.txt b/plugins/epan/irda/CMakeLists.txt index c30026b91d..a67568cbb3 100644 --- a/plugins/epan/irda/CMakeLists.txt +++ b/plugins/epan/irda/CMakeLists.txt @@ -54,6 +54,8 @@ register_plugin_files(plugin.c add_plugin_library(irda epan) +target_link_libraries(irda epan) + install_plugin(irda epan) file(GLOB DISSECTOR_HEADERS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "*.h") diff --git a/plugins/epan/mate/CMakeLists.txt b/plugins/epan/mate/CMakeLists.txt index da7451b3e3..6440f01b41 100644 --- a/plugins/epan/mate/CMakeLists.txt +++ b/plugins/epan/mate/CMakeLists.txt @@ -74,6 +74,8 @@ register_plugin_files(plugin.c add_plugin_library(mate epan) +target_link_libraries(mate epan) + install_plugin(mate epan) file(GLOB DISSECTOR_HEADERS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "*.h") diff --git a/plugins/epan/opcua/CMakeLists.txt b/plugins/epan/opcua/CMakeLists.txt index ca1dc9e34e..9473ef1444 100644 --- a/plugins/epan/opcua/CMakeLists.txt +++ b/plugins/epan/opcua/CMakeLists.txt @@ -68,6 +68,8 @@ register_plugin_files(plugin.c add_plugin_library(opcua epan) +target_link_libraries(opcua epan) + install_plugin(opcua epan) file(GLOB DISSECTOR_HEADERS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "*.h") diff --git a/plugins/epan/pluginifdemo/CMakeLists.txt b/plugins/epan/pluginifdemo/CMakeLists.txt index 2125a1e9b3..341682aa3a 100644 --- a/plugins/epan/pluginifdemo/CMakeLists.txt +++ b/plugins/epan/pluginifdemo/CMakeLists.txt @@ -67,7 +67,7 @@ register_plugin_files(plugin.c add_plugin_library(pluginifdemo epan) -target_link_libraries(pluginifdemo Qt5::Core Qt5::Widgets Qt5::PrintSupport) +target_link_libraries(pluginifdemo epan Qt5::Core Qt5::Widgets Qt5::PrintSupport) install_plugin(pluginifdemo epan) diff --git a/plugins/epan/profinet/CMakeLists.txt b/plugins/epan/profinet/CMakeLists.txt index 86798676f1..581c6f9f73 100644 --- a/plugins/epan/profinet/CMakeLists.txt +++ b/plugins/epan/profinet/CMakeLists.txt @@ -66,6 +66,8 @@ register_plugin_files(plugin.c add_plugin_library(profinet epan) +target_link_libraries(profinet epan) + install_plugin(profinet epan) file(GLOB DISSECTOR_HEADERS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "*.h") diff --git a/plugins/epan/stats_tree/CMakeLists.txt b/plugins/epan/stats_tree/CMakeLists.txt index 92172c72d3..27cff79021 100644 --- a/plugins/epan/stats_tree/CMakeLists.txt +++ b/plugins/epan/stats_tree/CMakeLists.txt @@ -41,6 +41,8 @@ set_source_files_properties( add_plugin_library(stats_tree epan) +target_link_libraries(stats_tree epan) + install_plugin(stats_tree epan) file(GLOB PLUGIN_HEADERS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "*.h") diff --git a/plugins/epan/transum/CMakeLists.txt b/plugins/epan/transum/CMakeLists.txt index c814704da8..18eb54bd7c 100644 --- a/plugins/epan/transum/CMakeLists.txt +++ b/plugins/epan/transum/CMakeLists.txt @@ -59,6 +59,8 @@ register_plugin_files(plugin.c add_plugin_library(transum epan) +target_link_libraries(transum epan) + install_plugin(transum epan) file(GLOB DISSECTOR_HEADERS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "*.h") diff --git a/plugins/epan/unistim/CMakeLists.txt b/plugins/epan/unistim/CMakeLists.txt index e9472df64e..6aeb7b84ef 100644 --- a/plugins/epan/unistim/CMakeLists.txt +++ b/plugins/epan/unistim/CMakeLists.txt @@ -52,6 +52,8 @@ register_plugin_files(plugin.c add_plugin_library(unistim epan) +target_link_libraries(unistim epan) + install_plugin(unistim epan) file(GLOB DISSECTOR_HEADERS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "*.h") diff --git a/plugins/epan/wimax/CMakeLists.txt b/plugins/epan/wimax/CMakeLists.txt index 8d7d201060..9419415cfc 100644 --- a/plugins/epan/wimax/CMakeLists.txt +++ b/plugins/epan/wimax/CMakeLists.txt @@ -99,6 +99,8 @@ register_plugin_files(plugin.c add_plugin_library(wimax epan) +target_link_libraries(wimax epan) + install_plugin(wimax epan) file(GLOB DISSECTOR_HEADERS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "*.h") diff --git a/plugins/epan/wimaxasncp/CMakeLists.txt b/plugins/epan/wimaxasncp/CMakeLists.txt index b2abc0ca31..3698520775 100644 --- a/plugins/epan/wimaxasncp/CMakeLists.txt +++ b/plugins/epan/wimaxasncp/CMakeLists.txt @@ -57,6 +57,8 @@ register_plugin_files(plugin.c add_plugin_library(wimaxasncp epan) +target_link_libraries(wimaxasncp epan) + install_plugin(wimaxasncp epan) file(GLOB DISSECTOR_HEADERS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "*.h") diff --git a/plugins/epan/wimaxmacphy/CMakeLists.txt b/plugins/epan/wimaxmacphy/CMakeLists.txt index 62040932c6..efd819db18 100644 --- a/plugins/epan/wimaxmacphy/CMakeLists.txt +++ b/plugins/epan/wimaxmacphy/CMakeLists.txt @@ -52,6 +52,8 @@ register_plugin_files(plugin.c add_plugin_library(wimaxmacphy epan) +target_link_libraries(wimaxmacphy epan) + install_plugin(wimaxmacphy epan) file(GLOB DISSECTOR_HEADERS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "*.h") diff --git a/plugins/wiretap/usbdump/CMakeLists.txt b/plugins/wiretap/usbdump/CMakeLists.txt index daa98b4840..5093353ff3 100644 --- a/plugins/wiretap/usbdump/CMakeLists.txt +++ b/plugins/wiretap/usbdump/CMakeLists.txt @@ -43,6 +43,8 @@ register_plugin_files(plugin.c add_plugin_library(usbdump wiretap) +target_link_libraries(usbdump wiretap) + install_plugin(usbdump wiretap) file(GLOB WIRETAP_HEADERS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "*.h")