ansilove

ANSI and ASCII art to PNG converter in C
Log | Files | Refs | README | LICENSE

CMakeLists.txt (1909B)


      1 cmake_minimum_required(VERSION 2.8.12)
      2 
      3 project(ansilove C)
      4 
      5 include(CheckFunctionExists)
      6 include(GNUInstallDirs)
      7 
      8 # Conditional build options
      9 set(ENABLE_SECCOMP 0 CACHE BOOL "Enable building with seccomp")
     10 
     11 # Check if system has pledge and strtonum
     12 list(APPEND CMAKE_REQUIRED_DEFINITIONS -D_OPENBSD_SOURCE)
     13 check_function_exists(pledge HAVE_PLEDGE)
     14 check_function_exists(strtonum HAVE_STRTONUM)
     15 
     16 if(ENABLE_SECCOMP)
     17   # Check if system has seccomp
     18   message(STATUS "Looking for seccomp")
     19   find_path(SECCOMP NAMES "linux/seccomp.h")
     20   if(SECCOMP)
     21     message(STATUS "Looking for seccomp - found")
     22     add_definitions(-DHAVE_SECCOMP)
     23   else()
     24     message(STATUS "Looking for seccomp - not found")
     25   endif()
     26 endif(ENABLE_SECCOMP)
     27 
     28 # Additional include directories for compat functions
     29 include_directories("compat")
     30 
     31 # Ansilove library
     32 find_path(ANSILOVE_INCLUDE_DIRS ansilove.h)
     33 find_library(ANSILOVE_LIBRARIES NAMES ansilove REQUIRED)
     34 include_directories(${ANSILOVE_INCLUDE_DIRS})
     35 
     36 set(SRC src/ansilove.c src/types.c src/strtolower.c src/sauce.c)
     37 
     38 if(NOT HAVE_PLEDGE)
     39   set(SRC ${SRC} compat/pledge.c)
     40 endif()
     41 
     42 if(NOT HAVE_STRTONUM)
     43   set(SRC ${SRC} compat/strtonum.c)
     44 endif()
     45 
     46 add_definitions(-D_GNU_SOURCE -Wall -Wextra -std=c99 -pedantic)
     47 add_executable(ansilove ${SRC})
     48 
     49 target_link_libraries(ansilove ${ANSILOVE_LIBRARIES} m)
     50 
     51 install(TARGETS ansilove DESTINATION ${CMAKE_INSTALL_BINDIR})
     52 install(FILES ansilove.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1/)
     53 
     54 enable_testing()
     55 add_test(ansilove ansilove)
     56 add_test(ansi ansilove ${PROJECT_SOURCE_DIR}/tests/bs-alove.ans)
     57 add_test(artworx ansilove ${PROJECT_SOURCE_DIR}/tests/bs-alove.adf)
     58 add_test(bin ansilove -c 80 ${PROJECT_SOURCE_DIR}/tests/bs-alove.bin)
     59 add_test(pcboard ansilove ${PROJECT_SOURCE_DIR}/tests/bs-alove.pcb)
     60 add_test(tundra ansilove ${PROJECT_SOURCE_DIR}/tests/bs-alove.tnd)
     61 add_test(xbin ansilove ${PROJECT_SOURCE_DIR}/tests/bs-alove.xb)