-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
72 lines (63 loc) · 1.91 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
# Copyright (c) 2022 Tobias Heider <[email protected]>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
cmake_minimum_required(VERSION 3.12)
include(CheckFunctionExists)
include(CheckIncludeFiles)
project(cu)
add_definitions(-D_GNU_SOURCE)
check_function_exists(closefrom HAVE_CLOSEFROM)
if(HAVE_CLOSEFROM)
add_definitions(-DHAVE_CLOSEFROM)
endif()
check_include_files("linux/close_range.h" HAVE_LINUX_CLOSE_RANGE_H)
if(HAVE_LINUX_CLOSE_RANGE_H)
add_definitions(-DHAVE_LINUX_CLOSE_RANGE_H)
endif()
check_function_exists(close_range HAVE_CLOSE_RANGE)
if(HAVE_CLOSE_RANGE)
add_definitions(-DHAVE_CLOSE_RANGE)
endif()
set(CFLAGS)
list(APPEND CFLAGS
-O2
-Wall
-Wno-pointer-sign
-Wno-deprecated-declarations
-Wstrict-prototypes
-Wmissing-prototypes
-Wmissing-declarations
-Wshadow
-Wpointer-arith
-Wcast-qual
-Wsign-compare
"$<$<CONFIG:DEBUG>:-O0;-g>"
)
add_executable(cu
command.c
cu.c
error.c
input.c
xmodem.c
compat/closefrom.c
compat/strtonum.c
compat/vis.c
)
target_compile_options(cu PRIVATE ${CFLAGS})
target_link_libraries(cu event)
target_include_directories(cu PUBLIC
compat
)
install(TARGETS cu RUNTIME DESTINATION bin)
set (CMAKE_INSTALL_MANDIR /usr/share/man)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/cu.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1/)