53 lines
1.5 KiB
CMake
53 lines
1.5 KiB
CMake
cmake_minimum_required(VERSION 3.11...3.16)
|
|
# 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(fediblock-backend
|
|
VERSION 0.1.0
|
|
DESCRIPTION "Turns form data into JSON and opens a pull request."
|
|
LANGUAGES CXX)
|
|
|
|
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
|
|
|
|
# Project build options.
|
|
option(WITH_CLANG-TIDY "Check sourcecode with clang-tidy while compiling." NO)
|
|
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)
|
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
|
|
include(cmake/debug_flags.cmake)
|
|
|
|
if(WITH_CLANG-TIDY)
|
|
set(CMAKE_CXX_CLANG_TIDY
|
|
"clang-tidy"
|
|
"-header-filter=${PROJECT_SOURCE_DIR}"
|
|
"-quiet")
|
|
endif()
|
|
|
|
# Dependencies.
|
|
find_package(PkgConfig REQUIRED)
|
|
pkg_check_modules(cgicc REQUIRED IMPORTED_TARGET cgicc)
|
|
find_package(nlohmann_json REQUIRED CONFIG)
|
|
find_package(Filesystem REQUIRED COMPONENTS Final Experimental)
|
|
pkg_check_modules(libgit2 REQUIRED IMPORTED_TARGET libgit2)
|
|
find_package(CURL 7.56 REQUIRED)
|
|
|
|
add_subdirectory(src)
|
|
add_subdirectory(src/generators)
|
|
|
|
if(WITH_TESTS)
|
|
add_subdirectory(tests)
|
|
endif()
|
|
|
|
include(cmake/packages.cmake)
|