ansilove

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

CMakeLists.txt (1914B)


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