2020-02-24 20:13:53 +01:00
|
|
|
# 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(FediPotato
|
|
|
|
VERSION 0.0.0
|
|
|
|
DESCRIPTION "Client for Fediverse servers."
|
|
|
|
LANGUAGES CXX)
|
|
|
|
|
|
|
|
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
|
|
|
|
|
|
|
|
# Project build options.
|
2020-02-28 19:18:20 +01:00
|
|
|
option(WITH_GUI "Compile and install GUI." YES)
|
2020-02-24 20:13:53 +01:00
|
|
|
option(WITH_TESTS "Compile tests." NO)
|
|
|
|
option(WITH_DEB "Prepare for the building of .deb packages." NO)
|
|
|
|
option(WITH_RPM "Prepare for the building of .rpm packages." NO)
|
|
|
|
option(WITH_CLANG-TIDY "Check sourcecode with clang-tidy while compiling." NO)
|
2020-02-25 18:12:41 +01:00
|
|
|
option(WITH_DOC "Generate API documentation." NO)
|
2020-02-24 20:13:53 +01:00
|
|
|
|
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
|
|
|
2020-02-25 18:12:58 +01:00
|
|
|
include(cmake/debug_flags.cmake)
|
2020-02-24 20:13:53 +01:00
|
|
|
|
|
|
|
if(WITH_CLANG-TIDY)
|
|
|
|
set(CMAKE_CXX_CLANG_TIDY
|
|
|
|
"clang-tidy"
|
|
|
|
"-header-filter=${PROJECT_SOURCE_DIR}"
|
|
|
|
"-quiet")
|
|
|
|
endif()
|
|
|
|
|
2020-02-29 22:11:16 +01:00
|
|
|
add_subdirectory(cmake)
|
|
|
|
|
2020-02-24 20:13:53 +01:00
|
|
|
add_subdirectory(lib)
|
2020-02-28 19:18:20 +01:00
|
|
|
|
|
|
|
if(WITH_GUI)
|
|
|
|
add_subdirectory(gui)
|
|
|
|
endif()
|
2020-02-24 20:13:53 +01:00
|
|
|
|
2020-03-02 07:05:18 +01:00
|
|
|
if(WITH_TESTS)
|
|
|
|
add_subdirectory(tests)
|
|
|
|
endif()
|
2020-02-24 20:13:53 +01:00
|
|
|
|
|
|
|
include(cmake/packages.cmake)
|