statzone

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

CMakeLists.txt (1579B)


      1 #
      2 # StatZone 1.0.4
      3 # Copyright (c) 2012-2020, Frederic Cambus
      4 # https://www.statdns.com
      5 #
      6 # Created: 2012-02-13
      7 # Last Updated: 2020-10-10
      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(CMAKE_BUILD_TYPE Release)
     48 set(SRC src/statzone.c src/strtolower.c)
     49 
     50 if(NOT HAVE_PLEDGE)
     51   set (SRC ${SRC} compat/pledge.c)
     52 endif()
     53 
     54 add_definitions(-D_GNU_SOURCE -D_FORTIFY_SOURCE=2 -Wall -Wextra -std=c99 -pedantic)
     55 add_executable(statzone ${SRC})
     56 
     57 install(TARGETS statzone DESTINATION ${CMAKE_INSTALL_BINDIR})
     58 install(FILES statzone.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1/)
     59 
     60 enable_testing()
     61 add_test(statzone statzone)
     62 add_test(processing statzone ${PROJECT_SOURCE_DIR}/tests/arpa.zone)