mastodonpp/CMakeLists.txt

72 lines
1.9 KiB
CMake
Raw Permalink Normal View History

2020-01-03 08:30:29 +01:00
# Support version 3.9 and above, but use policy settings up to 3.14.
# 3.9 is needed for project description.
2020-05-19 19:33:34 +02:00
cmake_minimum_required(VERSION 3.9...3.16)
2020-01-03 08:30:29 +01:00
# 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)
2020-05-19 19:17:58 +02:00
# Not every non-debug build type adds -DNDEBUG.
if(NOT ${CMAKE_BUILD_TYPE} MATCHES "Debug")
if(${CMAKE_VERSION} VERSION_LESS 3.12)
add_definitions("-DNDEBUG")
else()
add_compile_definitions("NDEBUG")
endif()
2020-05-19 19:17:58 +02:00
endif()
2020-01-03 08:30:29 +01:00
project(mastodonpp
VERSION 0.5.7
2020-01-10 20:12:19 +01:00
DESCRIPTION "C++ wrapper for the Mastodon and Pleroma APIs."
2020-01-03 08:30:29 +01:00
LANGUAGES CXX)
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
# Project build options.
2020-01-03 09:47:16 +01:00
option(WITH_TESTS "Compile tests." NO)
2020-01-03 10:22:34 +01:00
option(WITH_EXAMPLES "Compile examples." NO)
2020-11-13 14:25:22 +01:00
option(WITH_DOC "Generate API documentation." NO)
2020-01-09 18:16:04 +01:00
option(WITH_DEB "Prepare for the building of .deb packages." NO)
option(WITH_RPM "Prepare for the building of .rpm packages." NO)
2020-01-26 05:17:04 +01:00
option(WITH_CLANG-TIDY "Check sourcecode with clang-tidy while compiling." NO)
2020-01-03 08:30:29 +01:00
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
include(debug_flags)
2020-01-26 05:17:04 +01:00
if(WITH_CLANG-TIDY)
set(CMAKE_CXX_CLANG_TIDY
"clang-tidy"
"-header-filter=${PROJECT_SOURCE_DIR}"
"-quiet")
endif()
2020-01-03 08:30:29 +01:00
add_subdirectory(src)
2020-01-03 16:03:08 +01:00
add_subdirectory(include)
2020-01-03 16:27:59 +01:00
add_subdirectory(cmake)
2020-01-03 16:27:59 +01:00
add_subdirectory(pkg-config)
2020-01-03 08:30:29 +01:00
2020-01-03 09:47:16 +01:00
if(WITH_TESTS)
add_subdirectory(tests)
endif()
2020-01-03 08:30:29 +01:00
2020-01-03 10:22:34 +01:00
if(WITH_EXAMPLES)
add_subdirectory(examples)
endif()
2020-11-13 14:25:22 +01:00
if(WITH_DOC)
include(cmake/Doxygen.cmake)
enable_doxygen(
"${CMAKE_CURRENT_SOURCE_DIR}/include"
"${CMAKE_CURRENT_SOURCE_DIR}/src")
endif()
include(cmake/packages.cmake)