2018-05-17 12:41:15 +00:00
|
|
|
# CMakeLists.txt
|
|
|
|
#
|
|
|
|
# Wireshark - Network traffic analyzer
|
|
|
|
# By Gerald Combs <gerald@wireshark.org>
|
|
|
|
# Copyright 1998 Gerald Combs
|
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
#
|
|
|
|
|
|
|
|
if(EXTCAP_ANDROIDDUMP_LIBPCAP)
|
|
|
|
set(ANDROIDDUMP_USE_LIBPCAP 1)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(LIBSSH_FOUND)
|
|
|
|
SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${LIBSSH_LIBRARIES})
|
|
|
|
CHECK_FUNCTION_EXISTS(ssh_userauth_agent LIBSSH_USERAUTH_AGENT_FOUND)
|
|
|
|
if(LIBSSH_USERAUTH_AGENT_FOUND)
|
|
|
|
set(HAVE_SSH_USERAUTH_AGENT 1)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# Ensure "run/extcap" exists
|
|
|
|
# add_custom_command(OUTPUT "${DATAFILE_DIR}/extcap"
|
|
|
|
# COMMAND ${CMAKE_COMMAND} -E make_directory
|
|
|
|
# "${DATAFILE_DIR}/extcap"
|
|
|
|
# )
|
|
|
|
# list(APPEND copy_data_files_depends "${DATAFILE_DIR}/extcap")
|
|
|
|
|
|
|
|
|
|
|
|
macro(set_extcap_executable_properties _executable)
|
2019-01-21 10:56:57 +00:00
|
|
|
set_target_properties(${_executable} PROPERTIES
|
|
|
|
LINK_FLAGS "${WS_LINK_FLAGS}"
|
|
|
|
FOLDER "Executables/Extcaps"
|
|
|
|
INSTALL_RPATH "${EXTCAP_INSTALL_RPATH}"
|
|
|
|
)
|
2018-05-17 12:41:15 +00:00
|
|
|
|
|
|
|
set(PROGLIST ${PROGLIST} ${_executable})
|
|
|
|
|
|
|
|
if(WIN32)
|
|
|
|
set_target_properties(${_executable} PROPERTIES
|
|
|
|
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/run/extcap
|
|
|
|
RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/run/Debug/extcap
|
|
|
|
RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/run/Release/extcap
|
|
|
|
RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL ${CMAKE_BINARY_DIR}/run/MinSizeRel/extcap
|
|
|
|
RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${CMAKE_BINARY_DIR}/run/RelWithDebInfo/extcap
|
|
|
|
)
|
|
|
|
else()
|
|
|
|
set_target_properties(${_executable} PROPERTIES
|
|
|
|
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/run/extcap
|
|
|
|
)
|
|
|
|
if(ENABLE_APPLICATION_BUNDLE)
|
2018-06-15 10:44:47 +00:00
|
|
|
if(NOT CMAKE_CFG_INTDIR STREQUAL ".")
|
|
|
|
# Xcode
|
|
|
|
set_target_properties(${_executable} PROPERTIES
|
|
|
|
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/run/$<CONFIG>/Wireshark.app/Contents/MacOS/extcap
|
|
|
|
)
|
|
|
|
else()
|
|
|
|
set_target_properties(${_executable} PROPERTIES
|
|
|
|
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/run/Wireshark.app/Contents/MacOS/extcap
|
|
|
|
)
|
|
|
|
# Add a wrapper script which runs each executable from the
|
|
|
|
# correct location. This adds convenience but makes debugging
|
|
|
|
# more difficult.
|
|
|
|
file(REMOVE ${CMAKE_BINARY_DIR}/run/${_executable})
|
|
|
|
file(WRITE ${CMAKE_BINARY_DIR}/run/${_executable} "#!/bin/sh\n")
|
|
|
|
file(APPEND ${CMAKE_BINARY_DIR}/run/${_executable} "exec ${CMAKE_BINARY_DIR}/run/Wireshark.app/Contents/MacOS/extcap/${_executable} \"\$\@\"\n")
|
|
|
|
execute_process(COMMAND chmod a+x ${CMAKE_BINARY_DIR}/run/${_executable})
|
|
|
|
endif()
|
2018-05-17 12:41:15 +00:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
endmacro()
|
|
|
|
|
|
|
|
add_custom_target(extcaps)
|
|
|
|
|
2019-01-12 11:43:18 +00:00
|
|
|
add_library(extcap-base OBJECT extcap-base.c)
|
|
|
|
if(LIBSSH_FOUND)
|
|
|
|
add_library(ssh-base OBJECT ssh-base.c)
|
2019-01-10 01:45:00 +00:00
|
|
|
target_include_directories(ssh-base SYSTEM
|
|
|
|
PRIVATE
|
|
|
|
${LIBSSH_INCLUDE_DIRS}
|
|
|
|
)
|
2019-01-12 11:43:18 +00:00
|
|
|
endif()
|
|
|
|
|
2018-05-17 12:41:15 +00:00
|
|
|
if(BUILD_androiddump)
|
|
|
|
if(EXTCAP_ANDROIDDUMP_LIBPCAP)
|
|
|
|
if(HAVE_LIBPCAP)
|
|
|
|
set(androiddump_LIBS
|
|
|
|
ui
|
|
|
|
${GLIB2_LIBRARIES}
|
|
|
|
${PCAP_LIBRARIES}
|
|
|
|
)
|
|
|
|
else()
|
|
|
|
message(FATAL_ERROR "You are trying to build androiddump with libpcap but do not have it")
|
|
|
|
endif()
|
|
|
|
else()
|
|
|
|
set(androiddump_LIBS
|
|
|
|
ui
|
|
|
|
wiretap
|
|
|
|
${GLIB2_LIBRARIES}
|
|
|
|
${ZLIB_LIBRARIES}
|
|
|
|
${CMAKE_DL_LIBS}
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
set(androiddump_FILES
|
2019-01-12 11:43:18 +00:00
|
|
|
$<TARGET_OBJECTS:cli_main>
|
|
|
|
$<TARGET_OBJECTS:extcap-base>
|
2018-05-17 12:41:15 +00:00
|
|
|
androiddump.c
|
|
|
|
)
|
|
|
|
|
2018-10-08 23:34:39 +00:00
|
|
|
set_executable_resources(androiddump "Androiddump")
|
2018-10-09 15:44:54 +00:00
|
|
|
add_executable(androiddump ${androiddump_FILES})
|
2018-05-17 12:41:15 +00:00
|
|
|
set_extcap_executable_properties(androiddump)
|
|
|
|
target_link_libraries(androiddump ${androiddump_LIBS})
|
2018-08-21 21:23:46 +00:00
|
|
|
install(TARGETS androiddump RUNTIME DESTINATION ${EXTCAP_INSTALL_LIBDIR})
|
2018-05-17 12:41:15 +00:00
|
|
|
add_dependencies(extcaps androiddump)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(BUILD_sshdump AND LIBSSH_FOUND)
|
|
|
|
set(sshdump_LIBS
|
|
|
|
wsutil
|
|
|
|
${GLIB2_LIBRARIES}
|
|
|
|
${CMAKE_DL_LIBS}
|
|
|
|
${LIBSSH_LIBRARIES}
|
|
|
|
)
|
|
|
|
set(sshdump_FILES
|
2019-01-12 11:43:18 +00:00
|
|
|
$<TARGET_OBJECTS:cli_main>
|
|
|
|
$<TARGET_OBJECTS:extcap-base>
|
|
|
|
$<TARGET_OBJECTS:ssh-base>
|
2018-05-17 12:41:15 +00:00
|
|
|
sshdump.c
|
|
|
|
)
|
|
|
|
|
2018-10-08 23:34:39 +00:00
|
|
|
set_executable_resources(sshdump "Sshdump")
|
2018-10-09 15:44:54 +00:00
|
|
|
add_executable(sshdump ${sshdump_FILES})
|
2018-05-17 12:41:15 +00:00
|
|
|
set_extcap_executable_properties(sshdump)
|
|
|
|
target_link_libraries(sshdump ${sshdump_LIBS})
|
2019-01-10 01:45:00 +00:00
|
|
|
target_include_directories(sshdump SYSTEM PRIVATE ${LIBSSH_INCLUDE_DIRS})
|
2018-08-21 21:23:46 +00:00
|
|
|
install(TARGETS sshdump RUNTIME DESTINATION ${EXTCAP_INSTALL_LIBDIR})
|
2018-05-17 12:41:15 +00:00
|
|
|
add_dependencies(extcaps sshdump)
|
|
|
|
elseif (BUILD_sshdump)
|
|
|
|
#message( WARNING "Cannot find libssh, cannot build sshdump" )
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(BUILD_ciscodump AND LIBSSH_FOUND)
|
|
|
|
set(ciscodump_LIBS
|
|
|
|
writecap
|
|
|
|
wsutil
|
|
|
|
${GLIB2_LIBRARIES}
|
|
|
|
${CMAKE_DL_LIBS}
|
|
|
|
${LIBSSH_LIBRARIES}
|
|
|
|
)
|
|
|
|
set(ciscodump_FILES
|
2019-01-12 11:43:18 +00:00
|
|
|
$<TARGET_OBJECTS:cli_main>
|
|
|
|
$<TARGET_OBJECTS:extcap-base>
|
|
|
|
$<TARGET_OBJECTS:ssh-base>
|
2018-05-17 12:41:15 +00:00
|
|
|
ciscodump.c
|
|
|
|
)
|
|
|
|
|
2018-10-08 23:34:39 +00:00
|
|
|
set_executable_resources(ciscodump "Ciscodump")
|
2018-10-09 15:44:54 +00:00
|
|
|
add_executable(ciscodump ${ciscodump_FILES})
|
2018-05-17 12:41:15 +00:00
|
|
|
set_extcap_executable_properties(ciscodump)
|
|
|
|
target_link_libraries(ciscodump ${ciscodump_LIBS})
|
2019-01-10 01:45:00 +00:00
|
|
|
target_include_directories(ciscodump SYSTEM PRIVATE ${LIBSSH_INCLUDE_DIRS})
|
2018-08-21 21:23:46 +00:00
|
|
|
install(TARGETS ciscodump RUNTIME DESTINATION ${EXTCAP_INSTALL_LIBDIR})
|
2018-05-17 12:41:15 +00:00
|
|
|
add_dependencies(extcaps ciscodump)
|
|
|
|
elseif (BUILD_ciscodump)
|
|
|
|
#message( WARNING "Cannot find libssh, cannot build ciscodump" )
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(BUILD_dpauxmon AND HAVE_LIBNL3)
|
|
|
|
set(dpauxmon_LIBS
|
|
|
|
${GLIB2_LIBRARIES}
|
|
|
|
${CMAKE_DL_LIBS}
|
|
|
|
wsutil
|
|
|
|
writecap
|
|
|
|
${NL_LIBRARIES}
|
|
|
|
)
|
|
|
|
set(dpauxmon_FILES
|
2019-01-12 11:43:18 +00:00
|
|
|
$<TARGET_OBJECTS:extcap-base>
|
2018-05-17 12:41:15 +00:00
|
|
|
dpauxmon.c
|
|
|
|
)
|
|
|
|
|
2018-10-08 23:34:39 +00:00
|
|
|
set_executable_resources(dpauxmon "dpauxmon")
|
2018-10-09 15:44:54 +00:00
|
|
|
add_executable(dpauxmon ${dpauxmon_FILES})
|
2018-05-17 12:41:15 +00:00
|
|
|
set_extcap_executable_properties(dpauxmon)
|
|
|
|
target_link_libraries(dpauxmon ${dpauxmon_LIBS})
|
2019-01-10 01:45:00 +00:00
|
|
|
target_include_directories(dpauxmon SYSTEM PRIVATE ${NL_INCLUDE_DIRS})
|
2018-08-21 21:23:46 +00:00
|
|
|
install(TARGETS dpauxmon RUNTIME DESTINATION ${EXTCAP_INSTALL_LIBDIR})
|
2018-05-17 12:41:15 +00:00
|
|
|
add_dependencies(extcaps dpauxmon)
|
|
|
|
elseif (BUILD_dpauxmon)
|
|
|
|
#message( WARNING "Cannot find libnl3, cannot build dpauxmon" )
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(BUILD_udpdump)
|
|
|
|
set(udpdump_LIBS
|
|
|
|
${GLIB2_LIBRARIES}
|
|
|
|
${CMAKE_DL_LIBS}
|
|
|
|
wsutil
|
|
|
|
writecap
|
|
|
|
)
|
|
|
|
set(udpdump_FILES
|
2019-01-12 11:43:18 +00:00
|
|
|
$<TARGET_OBJECTS:cli_main>
|
|
|
|
$<TARGET_OBJECTS:extcap-base>
|
2018-05-17 12:41:15 +00:00
|
|
|
udpdump.c
|
|
|
|
)
|
|
|
|
|
2018-10-08 23:34:39 +00:00
|
|
|
set_executable_resources(udpdump "udpdump")
|
2018-10-09 15:44:54 +00:00
|
|
|
add_executable(udpdump ${udpdump_FILES})
|
2018-05-17 12:41:15 +00:00
|
|
|
set_extcap_executable_properties(udpdump)
|
|
|
|
target_link_libraries(udpdump ${udpdump_LIBS})
|
2018-08-21 21:23:46 +00:00
|
|
|
install(TARGETS udpdump RUNTIME DESTINATION ${EXTCAP_INSTALL_LIBDIR})
|
2018-05-17 12:41:15 +00:00
|
|
|
add_dependencies(extcaps udpdump)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(BUILD_randpktdump)
|
|
|
|
set(randpktdump_LIBS
|
|
|
|
randpkt_core
|
|
|
|
wiretap
|
|
|
|
${GLIB2_LIBRARIES}
|
|
|
|
${ZLIB_LIBRARIES}
|
|
|
|
${CMAKE_DL_LIBS}
|
|
|
|
)
|
|
|
|
set(randpktdump_FILES
|
2019-01-12 11:43:18 +00:00
|
|
|
$<TARGET_OBJECTS:cli_main>
|
|
|
|
$<TARGET_OBJECTS:extcap-base>
|
2018-05-17 12:41:15 +00:00
|
|
|
randpktdump.c
|
|
|
|
)
|
|
|
|
|
2018-10-08 23:34:39 +00:00
|
|
|
set_executable_resources(randpktdump "randpktdump")
|
2018-10-09 15:44:54 +00:00
|
|
|
add_executable(randpktdump ${randpktdump_FILES})
|
2018-05-17 12:41:15 +00:00
|
|
|
set_extcap_executable_properties(randpktdump)
|
|
|
|
target_link_libraries(randpktdump ${randpktdump_LIBS})
|
2018-08-21 21:23:46 +00:00
|
|
|
install(TARGETS randpktdump RUNTIME DESTINATION ${EXTCAP_INSTALL_LIBDIR})
|
2018-05-17 12:41:15 +00:00
|
|
|
add_dependencies(extcaps randpktdump)
|
|
|
|
endif()
|
|
|
|
|
2018-09-05 23:29:34 +00:00
|
|
|
if(BUILD_sdjournal AND SYSTEMD_FOUND)
|
|
|
|
set(sdjournal_LIBS
|
|
|
|
wiretap
|
|
|
|
writecap
|
|
|
|
wsutil
|
|
|
|
${GLIB2_LIBRARIES}
|
|
|
|
${ZLIB_LIBRARIES}
|
|
|
|
${CMAKE_DL_LIBS}
|
|
|
|
${SYSTEMD_LIBRARIES}
|
|
|
|
)
|
|
|
|
set(sdjournal_FILES
|
2019-01-12 11:43:18 +00:00
|
|
|
$<TARGET_OBJECTS:extcap-base>
|
2018-09-05 23:29:34 +00:00
|
|
|
sdjournal.c
|
|
|
|
)
|
|
|
|
|
2018-10-08 23:34:39 +00:00
|
|
|
set_executable_resources(sdjournal "sdjournal")
|
2018-10-09 15:44:54 +00:00
|
|
|
add_executable(sdjournal ${sdjournal_FILES})
|
2018-09-05 23:29:34 +00:00
|
|
|
set_extcap_executable_properties(sdjournal)
|
|
|
|
target_link_libraries(sdjournal ${sdjournal_LIBS})
|
2019-01-10 01:45:00 +00:00
|
|
|
target_include_directories(sdjournal SYSTEM PRIVATE ${SYSTEMD_INCLUDE_DIRS})
|
|
|
|
target_compile_definitions(sdjournal PRIVATE ${SYSTEMD_DEFINITIONS})
|
2018-09-05 23:29:34 +00:00
|
|
|
install(TARGETS sdjournal RUNTIME DESTINATION ${EXTCAP_INSTALL_LIBDIR})
|
|
|
|
add_dependencies(extcaps sdjournal)
|
|
|
|
elseif (BUILD_sdjournal)
|
|
|
|
#message( WARNING "Cannot find libsystemd, cannot build sdjournal" )
|
|
|
|
endif()
|
|
|
|
|
2019-01-12 11:43:18 +00:00
|
|
|
#
|
|
|
|
# Editor modelines - https://www.wireshark.org/tools/modelines.html
|
|
|
|
#
|
|
|
|
# Local variables:
|
|
|
|
# c-basic-offset: 8
|
|
|
|
# tab-width: 8
|
|
|
|
# indent-tabs-mode: t
|
|
|
|
# End:
|
|
|
|
#
|
|
|
|
# vi: set shiftwidth=8 tabstop=8 noexpandtab:
|
|
|
|
# :indentSize=8:tabSize=8:noTabs=false:
|
|
|
|
#
|