statzone

DNS zone file analyzer targeted at TLD zones
Log | Files | Refs | README | LICENSE

CMakeLists.txt (1529B)


      1 #
      2 # StatZone 1.0.3
      3 # Copyright (c) 2012-2020, Frederic Cambus
      4 # https://www.statdns.com
      5 #
      6 # Created: 2012-02-13
      7 # Last Updated: 2020-06-09
      8 #
      9 # StatZone is released under the BSD 2-Clause license
     10 # See LICENSE file for details.
     11 #
     12 
     13 cmake_minimum_required (VERSION 2.6)
     14 
     15 project (statzone C)
     16 
     17 include(CheckFunctionExists)
     18 include(GNUInstallDirs)
     19 
     20 # Conditional build options
     21 set(ENABLE_SECCOMP 0
     22     CACHE BOOL "Enable building with seccomp")
     23 
     24 # Check if system has pledge
     25 list(APPEND CMAKE_REQUIRED_DEFINITIONS -D_OPENBSD_SOURCE)
     26 check_function_exists(pledge HAVE_PLEDGE)
     27 
     28 if(ENABLE_SECCOMP)
     29   # Check if system has seccomp
     30   message(STATUS "Looking for seccomp")
     31   find_path(SECCOMP NAMES "linux/seccomp.h")
     32   if(SECCOMP)
     33     message(STATUS "Looking for seccomp - found")
     34     add_definitions(-DHAVE_SECCOMP)
     35   else()
     36     message(STATUS "Looking for seccomp - not found")
     37   endif()
     38 endif(ENABLE_SECCOMP)
     39 
     40 # Additional include directories for compat functions
     41 include_directories("compat")
     42 
     43 # uthash
     44 find_path(UTHASH_INCLUDE_DIRS uthash.h)
     45 include_directories(${UTHASH_INCLUDE_DIRS})
     46 
     47 set(SRC src/statzone.c src/strtolower.c)
     48 
     49 if(NOT HAVE_PLEDGE)
     50   set (SRC ${SRC} compat/pledge.c)
     51 endif()
     52 
     53 add_definitions(-D_GNU_SOURCE -Wall -Wextra -std=c99 -pedantic)
     54 add_executable(statzone ${SRC})
     55 
     56 install(TARGETS statzone DESTINATION ${CMAKE_INSTALL_BINDIR})
     57 install(FILES statzone.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1/)
     58 
     59 enable_testing()
     60 add_test(statzone statzone)
     61 add_test(processing statzone ${PROJECT_SOURCE_DIR}/tests/arpa.zone)