File: CMakeLists.txt

package info (click to toggle)
ansilove 4.1.5-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 320 kB
  • sloc: ansic: 773; makefile: 7
file content (62 lines) | stat: -rw-r--r-- 1,914 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
cmake_minimum_required (VERSION 2.6)

project (ansilove C)

include(CheckFunctionExists)
include(GNUInstallDirs)

# Conditional build options
set(ENABLE_SECCOMP 0
    CACHE BOOL "Enable building with seccomp")

# Check if system has pledge and strtonum
list(APPEND CMAKE_REQUIRED_DEFINITIONS -D_OPENBSD_SOURCE)
check_function_exists(pledge HAVE_PLEDGE)
check_function_exists(strtonum HAVE_STRTONUM)

if(ENABLE_SECCOMP)
  # Check if system has seccomp
  message(STATUS "Looking for seccomp")
  find_path(SECCOMP NAMES "linux/seccomp.h")
  if(SECCOMP)
    message(STATUS "Looking for seccomp - found")
    add_definitions(-DHAVE_SECCOMP)
  else()
    message(STATUS "Looking for seccomp - not found")
  endif()
endif(ENABLE_SECCOMP)

# Additional include directories for compat functions
include_directories("compat")

# Ansilove library
find_path(ANSILOVE_INCLUDE_DIRS ansilove.h)
find_library(ANSILOVE_LIBRARIES NAMES ansilove REQUIRED)
include_directories(${ANSILOVE_INCLUDE_DIRS})

set(SRC src/ansilove.c src/types.c src/strtolower.c src/sauce.c)

if(NOT HAVE_PLEDGE)
  set (SRC ${SRC} compat/pledge.c)
endif()

if(NOT HAVE_STRTONUM)
  set (SRC ${SRC} compat/strtonum.c)
endif()

add_definitions(-D_GNU_SOURCE -Wall -Wextra -std=c99 -pedantic)
add_executable(ansilove ${SRC})

target_link_libraries(ansilove ${ANSILOVE_LIBRARIES} m)

install(TARGETS ansilove DESTINATION ${CMAKE_INSTALL_BINDIR})
install(FILES ansilove.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1/)

enable_testing()
add_test(ansilove ansilove)
add_test(ansi ansilove ${PROJECT_SOURCE_DIR}/tests/bs-alove.ans)
add_test(artworx ansilove ${PROJECT_SOURCE_DIR}/tests/bs-alove.adf)
add_test(bin ansilove -c 80 ${PROJECT_SOURCE_DIR}/tests/bs-alove.bin)
add_test(pcboard ansilove ${PROJECT_SOURCE_DIR}/tests/bs-alove.pcb)
add_test(tundra ansilove ${PROJECT_SOURCE_DIR}/tests/bs-alove.tnd)
add_test(xbin ansilove ${PROJECT_SOURCE_DIR}/tests/bs-alove.xb)