mastorss/CMakeLists.txt

56 lines
1.7 KiB
CMake

# Support version 3.9 and above, but use policy settings up to 3.14.
# 3.9 is needed for project description.
cmake_minimum_required(VERSION 3.9...3.14)
# Ranges are supported from 3.12, set policy to current for < 3.12.
if(${CMAKE_VERSION} VERSION_LESS 3.12)
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
endif()
# Global build options.
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "The type of build.")
option(BUILD_SHARED_LIBS "Build shared libraries." YES)
project (mastorss
VERSION 0.11.0
DESCRIPTION "Another RSS to Mastodon bot."
LANGUAGES CXX)
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
# Project build options.
option(WITH_MAN "Compile and install manpage." YES)
option(WITH_DESKTOP "Build and install a .desktop file." NO)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
include(debug_flags)
include(GNUInstallDirs)
add_subdirectory(src)
if(WITH_MAN)
add_subdirectory(man)
endif()
install(FILES watchwords.json
DESTINATION "${CMAKE_INSTALL_DATADIR}/mastorss")
if(WITH_DESKTOP)
# Needed for AppImage.
configure_file("de.tastytea.${PROJECT_NAME}.desktop.in"
"${CMAKE_CURRENT_BINARY_DIR}/de.tastytea.${PROJECT_NAME}.desktop" @ONLY)
# linuxdeploy insists on an icon.
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/de.tastytea.${PROJECT_NAME}.svg" "")
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/de.tastytea.${PROJECT_NAME}.desktop"
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/applications")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/de.tastytea.${PROJECT_NAME}.svg"
"${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/apps")
endif()
# include(cmake/packages.cmake)