File: CMakeLists.txt

package info (click to toggle)
cmatrix 1.2a%2Bgit20181122-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 440 kB
  • sloc: ansic: 626; makefile: 53; sh: 44
file content (72 lines) | stat: -rw-r--r-- 2,318 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
# CMake build system for CMatrix

cmake_minimum_required(VERSION 2.8)

project(CMatrix LANGUAGES C)
set(VERSION "1.2")

# These are relative to CMAKE_INSTALL_PREFIX
# which by default is "/usr/local"
set(CONSOLE_FONTS_DIRS "share/consolefonts" "lib/kbd/consolefonts")
set(X_FONTS_DIRS "lib/X11/fonts/misc" "X11R6/lib/X11/fonts/misc" "share/fonts/X11/misc")

set(MKFONTDIR "/usr/bin/mkfontdir")

add_definitions(-DEXCLUDE_CONFIG_H)
add_definitions(-DVERSION="${VERSION}")

include(CheckIncludeFiles)
check_include_files("sys/ioctl.h" HAVE_SYS_IOCTL_H)
if	(HAVE_SYS_IOCTL_H)
	add_definitions(-DHAVE_SYS_IOCTL_H)
endif	()
check_include_files("unistd.h" HAVE_UNISTD_H)
if	(HAVE_UNISTD_H)
	add_definitions(-DHAVE_UNISTD_H)
endif	()
check_include_files("termios.h" HAVE_TERMIOS_H)
if	(HAVE_TERMIOS_H)
	add_definitions(-DHAVE_TERMIOS_H)
endif	()
check_include_files("termio.h" HAVE_TERMIO_H)
if	(HAVE_TERMIO_H)
	add_definitions(-DHAVE_TERMIO_H)
endif	()

Set(CURSES_NEED_NCURSES TRUE)
find_package(Curses)
include_directories(${CURSES_INCLUDE_DIR})
add_definitions(-DHAVE_NCURSES_H)

add_executable(cmatrix cmatrix.c)

target_link_libraries(cmatrix ${CURSES_LIBRARIES})

install(TARGETS cmatrix DESTINATION bin)

if     (UNIX)
	foreach    (CONSOLE_FONTS_DIR ${CONSOLE_FONTS_DIRS})
		if     (IS_DIRECTORY "${CMAKE_INSTALL_PREFIX}/${CONSOLE_FONTS_DIR}")
			message(STATUS "Installing matrix console fonts to ${CMAKE_INSTALL_PREFIX}/${CONSOLE_FONTS_DIR}")
			install(FILES
				"${CMAKE_SOURCE_DIR}/matrix.fnt"
				"${CMAKE_SOURCE_DIR}/matrix.psf.gz"
				DESTINATION "${CONSOLE_FONTS_DIR}")
		endif  ()
	endforeach ()
	foreach    (X_FONTS_DIR ${X_FONTS_DIRS})
		if     (IS_DIRECTORY "${CMAKE_INSTALL_PREFIX}/${X_FONTS_DIR}")
			message(STATUS "Installing matrix X window fonts to ${CMAKE_INSTALL_PREFIX}/${X_FONTS_DIR}")
			install(FILES
				"${CMAKE_SOURCE_DIR}/mtx.pcf"
				DESTINATION "${X_FONTS_DIR}")
			install(CODE
				"message(STATUS \"Running mkfontdir ${CMAKE_INSTALL_PREFIX}/${X_FONTS_DIR} ...\")")
			install(CODE
				"execute_process(COMMAND \"${MKFONTDIR}\" \"${CMAKE_INSTALL_PREFIX}/${X_FONTS_DIR}\")")
			install(CODE
				"message(STATUS \"If this is the first time you have installed CMatrix you will probably have to restart X window in order to use the mtx.pcf font.\")")
		endif  ()
	endforeach ()
endif  ()