-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
73 lines (61 loc) · 1.92 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
cmake_minimum_required(VERSION 3.3.1)
project(nav)
set(CMAKE_C_FLAGS "-g")
set(CMAKE_C_STANDARD 99)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wextra")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-parameter")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-sign-compare")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-missing-field-initializers")
add_definitions(-D_GNU_SOURCE)
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
execute_process(
COMMAND git describe --always
OUTPUT_VARIABLE GIT_COMMIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
endif()
add_definitions(-DNAV_VERSION=\"${GIT_COMMIT_HASH}\")
string(TIMESTAMP CURRENT_DATE "%Y-%m-%d" UTC)
add_definitions(-DNAV_DATE=\"${CURRENT_DATE}\")
set( CMAKE_EXPORT_COMPILE_COMMANDS ON )
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
include(CheckIncludeFiles)
include(CheckFunctionExists)
include(CheckSymbolExists)
include_directories("${PROJECT_SOURCE_DIR}/src")
file(GLOB_RECURSE SOURCES "${PROJECT_SOURCE_DIR}/src/nav/*.c")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/build)
add_executable(nav ${SOURCES})
set(CURSES_NEED_WIDE true)
find_package(Ncursesw REQUIRED)
find_package(PCRE REQUIRED)
find_package(LibUV REQUIRED)
find_package(LibTermkey REQUIRED)
target_include_directories(nav PUBLIC ${CURSES_INCLUDE_PATH})
target_link_libraries(nav ${CURSES_LIBRARY})
target_link_libraries(nav ${PCRE_LIBRARY})
target_link_libraries(nav ${LIBUV_LIBRARIES})
target_link_libraries(nav ${LIBTERMKEY_LIBRARIES})
target_link_libraries(nav util)
find_program(HAS_W3M w3m)
if (HAS_W3M)
add_definitions(-DW3M_SUPPORTED=1)
endif()
install(
TARGETS nav
RUNTIME
DESTINATION bin
COMPONENT runtime
)
install(
FILES ${PROJECT_SOURCE_DIR}/navrc
DESTINATION /etc/nav/
COMPONENT configuration
)
install(
FILES ${PROJECT_SOURCE_DIR}/nav.1
DESTINATION share/man/man1
COMPONENT documentation
)