-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #82 from wllm-rbnt/cmake
cmake
- Loading branch information
Showing
24 changed files
with
409 additions
and
273 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
cmake_minimum_required(VERSION 3.16.3) | ||
include(CheckSymbolExists) | ||
|
||
project( | ||
ssldump | ||
VERSION 1.8 | ||
DESCRIPTION 20230811 | ||
LANGUAGES C | ||
) | ||
|
||
configure_file(base/pcap-snoop.c.in base/pcap-snoop.c) | ||
|
||
set(SOURCES | ||
${CMAKE_BINARY_DIR}/base/pcap-snoop.c | ||
base/network.c | ||
base/proto_mod.c | ||
base/tcppack.c | ||
base/tcpconn.c | ||
null/null_analyze.c | ||
common/lib/r_data.c | ||
common/lib/r_assoc.c | ||
common/lib/r_errors.c | ||
common/lib/debug.c | ||
ssl/ssl_analyze.c | ||
ssl/ssldecode.c | ||
ssl/sslprint.c | ||
ssl/ssl.enums.c | ||
ssl/sslxprint.c | ||
ssl/ciphersuites.c | ||
ssl/ssl_rec.c | ||
pcap/logpkt.c | ||
pcap/pcap_logger.c | ||
pcap/sys.c | ||
) | ||
|
||
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/modules/" ${CMAKE_MODULE_PATH}) | ||
|
||
find_package(OpenSSL) | ||
if(NOT OPENSSL_FOUND) | ||
message( FATAL_ERROR | ||
"Unable to find OpenSSL development files on this system | ||
On Debian and Ubuntu systems you can install the required library and header files with | ||
apt install libssl-dev | ||
On Fedora systems, with | ||
dnf install openssl-devel" ) | ||
endif() | ||
|
||
#dnf install openssl-devel libpcap-devel libnet-devel json-c-devel | ||
|
||
find_package(PCAP) | ||
if(NOT PCAP_FOUND) | ||
message( FATAL_ERROR | ||
"Unable to find libpcap development files on this system | ||
On Debian and Ubuntu systems you can install the required library and header files with | ||
apt install libpcap-dev | ||
On Fedora systems, with | ||
dnf install libpcap-devel" ) | ||
endif() | ||
|
||
find_package(LIBNET) | ||
if(NOT LIBNET_FOUND) | ||
message( FATAL_ERROR | ||
"Unable to find libnet development files on this system | ||
On Debian and Ubuntu systems you can install the required library and header files with | ||
apt install libnet1-dev | ||
On Fedora systems, with | ||
dnf install libnet-devel" ) | ||
endif() | ||
|
||
find_package(JSONC) | ||
if(NOT JSONC_FOUND) | ||
message( FATAL_ERROR | ||
"Unable to find libjson-c development files on this system | ||
On Debian and Ubuntu systems you can install the required library and header files with | ||
apt install libjson-c-dev | ||
On Fedora systems, with | ||
dnf install json-c-devel" ) | ||
endif() | ||
|
||
add_executable(${PROJECT_NAME} ${SOURCES}) | ||
|
||
check_symbol_exists(strdup "string.h" HAVE_STRDUP) | ||
if(HAVE_STRDUP) | ||
add_definitions(-DHAVE_STRDUP) | ||
endif() | ||
|
||
add_definitions(-DLINUX) | ||
add_definitions(-DOPENSSL) | ||
add_definitions(-D_DEFAULT_SOURCE=1) | ||
|
||
target_include_directories(ssldump | ||
PRIVATE | ||
${PROJECT_SOURCE_DIR}/common/include | ||
${PROJECT_SOURCE_DIR}/common/lib | ||
${PROJECT_SOURCE_DIR}/null | ||
${PROJECT_SOURCE_DIR}/ssl | ||
${PROJECT_SOURCE_DIR}/base | ||
${PROJECT_SOURCE_DIR}/pcap | ||
${OPENSSL_INCLUDE_DIR} | ||
${PCAP_INCLUDE_DIR} | ||
${LIBNET_INCLUDE_DIR} | ||
${JSONC_INCLUDE_DIR} | ||
) | ||
|
||
target_link_libraries(ssldump | ||
PRIVATE | ||
${OPENSSL_LIBRARIES} | ||
${PCAP_LIBRARY} | ||
${LIBNET_LIBRARY} | ||
${JSONC_LIBRARIES} | ||
) | ||
|
||
set(CMAKE_INSTALL_PREFIX "/usr/local") | ||
install(TARGETS ssldump DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) | ||
|
||
set(CMAKE_INSTALL_MANDIR "/usr/local/share/man") | ||
install(FILES ssldump.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# From https://github.com/fastogt/cmake/blob/master/FindJSON-C.cmake | ||
# Copyright (c) 2018, FastoGT | ||
# License: BSD 3-Clause | ||
# Modified by: Micah Snyder | ||
|
||
# JSONC_FOUND - true if library and headers were found | ||
# JSONC_INCLUDE_DIRS - include directories | ||
# JSONC_LIBRARIES - library directories | ||
|
||
if(JSONC_USE_STATIC) | ||
add_library(jsonc STATIC IMPORTED GLOBAL) | ||
else() | ||
add_library(jsonc SHARED IMPORTED GLOBAL) | ||
endif(JSONC_USE_STATIC) | ||
|
||
find_package(PkgConfig QUIET) | ||
PKG_CHECK_MODULES(PC_JSONC QUIET json-c) | ||
|
||
find_path(JSONC_INCLUDE_DIR json.h | ||
HINTS ${PC_JSONC_INCLUDEDIR} ${PC_JSONC_INCLUDE_DIRS} PATH_SUFFIXES json-c json) | ||
|
||
if(JSONC_USE_STATIC) | ||
find_library(JSONC_LIBRARY NAMES libjson-c.a libjson-c-static.a | ||
HINTS ${PC_JSONC_LIBDIR} ${PC_JSONC_LIBRARY_DIRS}) | ||
else() | ||
find_library(JSONC_LIBRARY NAMES json-c libjson-c | ||
HINTS ${PC_JSONC_LIBDIR} ${PC_JSONC_LIBRARY_DIRS}) | ||
endif(JSONC_USE_STATIC) | ||
|
||
set(JSONC_LIBRARIES ${JSONC_LIBRARY}) | ||
set(JSONC_INCLUDE_DIRS ${JSONC_INCLUDE_DIR}) | ||
|
||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args(JSONC DEFAULT_MSG JSONC_LIBRARIES JSONC_INCLUDE_DIRS) | ||
|
||
if(JSONC_FOUND AND NOT TARGET JSONC::jsonc) | ||
add_library(JSONC::jsonc UNKNOWN IMPORTED) | ||
set_target_properties(JSONC::jsonc PROPERTIES | ||
IMPORTED_LOCATION "${JSONC_LIBRARY}" | ||
INTERFACE_COMPILE_OPTIONS "${PC_JSONC_CFLAGS_OTHER}" | ||
INTERFACE_INCLUDE_DIRECTORIES "${JSONC_INCLUDE_DIRS}" | ||
) | ||
endif() | ||
|
||
mark_as_advanced( | ||
JSONC_INCLUDE_DIR | ||
JSONC_LIBRARY | ||
) | ||
|
Oops, something went wrong.