# Compile the arpon.c source code
#
# Copyright 2014 <Giuseppe Marco Randazzo> gmrandazzo@gmail.com
#
# Redistribution AND use is allowed according to the terms of the BSD 3 clause

if(${CMAKE_INSTALL_PREFIX} STREQUAL "/")
  set(arpon_sarpi /etc/arpon.sarpi)
  set(install_prefix /sbin)
else(${CMAKE_INSTALL_PREFIX} STREQUAL "/")
  set(arpon_sarpi ${CMAKE_INSTALL_PREFIX}/etc/arpon.sarpi)
  set(install_prefix ${CMAKE_INSTALL_PREFIX}/sbin)
endif(${CMAKE_INSTALL_PREFIX} STREQUAL "/")

configure_file (
    "${PROJECT_SOURCE_DIR}/src/config.h.in"
    "${PROJECT_BINARY_DIR}/src/config.h")
include_directories("${PROJECT_BINARY_DIR}/src")

add_executable(arpon arpon.c include/queue.h)
target_link_libraries(arpon ${NET_LIB} ${DNET_LIB} ${PCAP_LIB} ${PTHREAD_LIB})
set_target_properties(arpon PROPERTIES INSTALL_RPATH_USE_LINK_PATH TRUE)
install(TARGETS arpon RUNTIME DESTINATION ${install_prefix} COMPONENT Application)
