-
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathCMakeLists.txt
91 lines (64 loc) · 2.88 KB
/
CMakeLists.txt
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
cmake_minimum_required(VERSION 3.9)
add_compile_options(-Wall -pedantic -Wextra)
project(httping LANGUAGES C VERSION "4.2.0")
# Create compile_commands.json file
set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
add_definitions(-DLOCALEDIR=\"/usr/local/share/locale\")
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)
find_package(Intl REQUIRED)
target_link_libraries(httping Intl::Intl)
if(USE_GETTEXT)
find_package(Gettext REQUIRED)
endif()
set(CMAKE_BUILD_TYPE Debug)
include(FindPkgConfig)
if(USE_TUI)
pkg_check_modules(NCURSES ncurses)
target_link_libraries(httping ${NCURSES_LIBRARIES})
target_include_directories(httping PUBLIC ${NCURSES_INCLUDE_DIRS})
target_compile_options(httping PUBLIC ${NCURSES_CFLAGS_OTHER})
pkg_check_modules(FFTW3 fftw3)
target_link_libraries(httping ${FFTW3_LIBRARIES})
target_include_directories(httping PUBLIC ${FFTW3_INCLUDE_DIRS})
target_compile_options(httping PUBLIC ${FFTW3_CFLAGS_OTHER})
endif()
find_package(OpenSSL REQUIRED)
target_link_libraries(httping OpenSSL::SSL OpenSSL::Crypto)
include(GNUInstallDirs)
if(USE_GETTEXT)
add_definitions(-DUSE_GETTEXT=1)
find_program(GETTEXT_MSGFMT_EXECUTABLE msgfmt)
if(NOT GETTEXT_MSGFMT_EXECUTABLE)
message("------ NOTE: msgfmt not found. Translations will *not* be installed ------")
else(NOT GETTEXT_MSGFMT_EXECUTABLE)
set(catalogname httping)
file(GLOB PO_FILES *.po)
set(GMO_FILES)
foreach(_poFile ${PO_FILES})
get_filename_component(_poFileName ${_poFile} NAME)
string(REGEX REPLACE "^${catalogname}_?" "" _langCode ${_poFileName} )
string(REGEX REPLACE "\\.po$" "" _langCode ${_langCode} )
if( _langCode )
get_filename_component(_lang ${_poFile} NAME_WE)
set(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_lang}.gmo)
add_custom_command(OUTPUT ${_gmoFile}
COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} --check -o ${_gmoFile} ${_poFile}
DEPENDS ${_poFile})
install(FILES ${_gmoFile} DESTINATION ${CMAKE_INSTALL_LOCALEDIR}/${_langCode}/LC_MESSAGES/ RENAME ${catalogname}.mo)
list(APPEND GMO_FILES ${_gmoFile})
endif( _langCode )
endforeach(_poFile ${PO_FILES})
add_custom_target(translations ALL DEPENDS ${GMO_FILES})
endif(NOT GETTEXT_MSGFMT_EXECUTABLE)
endif(USE_GETTEXT)
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})
if(USE_GETTEXT)
#install(FILES ${CMAKE_CURRENT_BINARY_DIR}/nl.mo DESTINATION ${CMAKE_INSTALL_LOCALEDIR})
#install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ru.mo DESTINATION ${CMAKE_INSTALL_LOCALEDIR})
endif()