File: CMakeLists.txt

package info (click to toggle)
httping 4.4.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 468 kB
  • sloc: ansic: 4,475; python: 66; php: 15; makefile: 12
file content (73 lines) | stat: -rw-r--r-- 2,184 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
cmake_minimum_required(VERSION 3.12)

add_compile_options(-Wall -pedantic -Wextra)

project(httping LANGUAGES C VERSION "4.4.0")

# Create compile_commands.json file
set(CMAKE_EXPORT_COMPILE_COMMANDS 1)

if(NOT PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR)
  # Git auto-ignore out-of-source build directory
  file(GENERATE OUTPUT .gitignore CONTENT "*")
endif()

option(USE_TUI "Enable text user interface" OFF)
option(USE_FFTW3 "Enable FFTW3 backend (depedns on USE_TUI)" OFF)
option(USE_SSL "Enable SSL support" OFF)
option(USE_GETTEXT "Enable interantionalization" OFF)

set(SOURCES  colors.c cookies.c error.c fft.c gen.c help.c http.c io.c kalman.c main.c mssl.c nc.c res.c socks5.c tcp.c utils.c)
add_executable(httping ${SOURCES})

target_link_libraries(httping m)

if(USE_GETTEXT)
  find_package(Gettext REQUIRED)

  find_package(Intl REQUIRED)
  target_link_libraries(httping Intl::Intl)
endif()

set(CMAKE_BUILD_TYPE Debug)

include(FindPkgConfig)

if(USE_TUI)
  pkg_check_modules(NCURSES REQUIRED ncurses)
  target_link_libraries(httping ${NCURSES_LIBRARIES})
  target_include_directories(httping PUBLIC ${NCURSES_INCLUDE_DIRS})
  target_compile_options(httping PUBLIC ${NCURSES_CFLAGS_OTHER})

  if(USE_FFTW3)
    pkg_check_modules(FFTW3 REQUIRED fftw3)
    target_link_libraries(httping ${FFTW3_LIBRARIES})
    target_include_directories(httping PUBLIC ${FFTW3_INCLUDE_DIRS})
    target_compile_options(httping PUBLIC ${FFTW3_CFLAGS_OTHER})
  endif()
endif()

if(USE_SSL)
  find_package(OpenSSL REQUIRED)
  target_link_libraries(httping OpenSSL::SSL OpenSSL::Crypto)
endif()

include(GNUInstallDirs)

if(USE_GETTEXT)
  add_subdirectory(po)
endif()

configure_file(config.h.in config.h)
target_include_directories(httping PUBLIC "${PROJECT_BINARY_DIR}")

install(TARGETS httping DESTINATION bin)
install(FILES README.md LICENSE plot-json.py DESTINATION ${CMAKE_INSTALL_DOCDIR})
install(FILES httping.1 DESTINATION ${CMAKE_INSTALL_MANDIR})

# setup summary
message(STATUS "CMake version: ${CMAKE_VERSION}")
message(STATUS "Use SSL: ${USE_SSL}")
message(STATUS "Use TUI: ${USE_TUI}")
message(STATUS "Use FFTW3: ${USE_FFTW3}")
message(STATUS "Use gettext: ${USE_GETTEXT}")