1
0

CMakeLists.txt 819 B

123456789101112131415161718192021
  1. cmake_minimum_required(VERSION 3.0)
  2. project(MilterFrom C)
  3. option(WITH_SYSTEMD "Install Systemd unit files" ON)
  4. set(SYSTEMD_UNITDIR "${CMAKE_INSTALL_PREFIX}/lib/systemd/system" CACHE PATH "Systemd unit directory")
  5. list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
  6. find_package(Threads REQUIRED)
  7. find_package(Milter REQUIRED)
  8. add_executable(milterfrom src/milterfrom.c)
  9. target_include_directories(milterfrom PRIVATE ${Milter_INCLUDE_DIRS})
  10. target_link_libraries(milterfrom ${Milter_LIBRARY} ${CMAKE_THREAD_LIBS_INIT})
  11. install(TARGETS milterfrom DESTINATION bin)
  12. if(NOT WIN32 AND WITH_SYSTEMD)
  13. configure_file(systemd/milterfrom.service.in ${CMAKE_CURRENT_BINARY_DIR}/systemd/milterfrom.service)
  14. install(FILES ${CMAKE_CURRENT_BINARY_DIR}/systemd/milterfrom.service DESTINATION ${SYSTEMD_UNITDIR})
  15. endif()