aboutsummaryrefslogblamecommitdiff
path: root/CMakeLists.txt
blob: 99b79b385853cdb113d30fd43868cffcc6c3c40b (plain) (tree)


































                                                                                        

                                        
cmake_minimum_required(VERSION 3.17.0)

project(rssmail VERSION 1.0.0 LANGUAGES C)

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

find_package(LibXml2 REQUIRED)
find_package(CURL REQUIRED)

add_executable(rssmail
  src/main.c
  src/fetch.c
  src/parse.c
  src/mail.c
  src/config.c
  src/post.c)

if(CMAKE_BUILD_TYPE STREQUAL "Debug")
  target_compile_options(rssmail PRIVATE -ggdb3 -fsanitize=address -fsanitize=undefined)
  target_link_options(rssmail PRIVATE -no-pie -fsanitize=address -fsanitize=undefined)
  target_compile_definitions(rssmail PRIVATE DEBUG RSSMAIL_SEND_TO_FILE)
endif()

# disabling logging may reduce binary size
# target_compile_definitions(rssmail PRIVATE RSSMAIL_DISABLE_LOGGING)

target_link_libraries(rssmail
  PRIVATE
  ${LIBXML2_LIBRARIES}
  ${CURL_LIBRARIES})
target_include_directories(rssmail
  PRIVATE
  "${CMAKE_CURRENT_SOURCE_DIR}/include"
  ${LIBXML2_INCLUDE_DIRS}
  ${CURL_INCLUDE_DIRS})

install(TARGETS rssmail DESTINATION bin)