2019-08-09 21:07:10 +02:00
|
|
|
# Support version 3.2 and above, but use policy settings up to 3.14.
|
|
|
|
cmake_minimum_required(VERSION 3.2...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()
|
|
|
|
|
2019-04-17 00:17:26 +02:00
|
|
|
project(gitea2rss
|
2019-08-10 20:21:16 +02:00
|
|
|
VERSION 0.5.1
|
2019-08-09 21:07:10 +02:00
|
|
|
LANGUAGES CXX)
|
2019-04-17 00:17:26 +02:00
|
|
|
|
2019-08-09 21:07:10 +02:00
|
|
|
# DESCRIPTION was introduced in version 3.9.
|
|
|
|
if(NOT (${CMAKE_VERSION} VERSION_LESS 3.9))
|
|
|
|
set(PROJECT_DESCRIPTION
|
|
|
|
"Generates RSS feeds from Gitea releases or tags.")
|
|
|
|
endif()
|
2019-04-20 13:01:58 +02:00
|
|
|
|
2019-08-09 21:07:10 +02:00
|
|
|
option(WITH_MAN "Compile and install manpage." YES)
|
|
|
|
option(WITH_TESTS "Compile tests." NO)
|
2019-04-17 00:17:26 +02:00
|
|
|
|
|
|
|
set(CMAKE_CXX_STANDARD 14)
|
|
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
|
|
|
2019-08-09 21:07:10 +02:00
|
|
|
set(DEBUG_CXXFLAGS
|
|
|
|
"-Wall"
|
|
|
|
"-Wextra"
|
|
|
|
"-Wpedantic"
|
|
|
|
"-ftrapv"
|
|
|
|
"-fsanitize=undefined"
|
|
|
|
"-g"
|
|
|
|
"-Og"
|
|
|
|
"-fno-omit-frame-pointer")
|
|
|
|
set(DEBUG_LDFLAGS
|
|
|
|
"-fsanitize=undefined")
|
|
|
|
add_compile_options("$<$<CONFIG:Debug>:${DEBUG_CXXFLAGS}>")
|
|
|
|
# add_link_options was introduced in version 3.13.
|
|
|
|
if(${CMAKE_VERSION} VERSION_LESS 3.13)
|
|
|
|
set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${DEBUG_LDFLAGS}")
|
|
|
|
else()
|
|
|
|
add_link_options("$<$<CONFIG:Debug>:${DEBUG_LDFLAGS}>")
|
|
|
|
endif()
|
2019-04-17 00:17:26 +02:00
|
|
|
|
2019-08-09 21:07:10 +02:00
|
|
|
find_package(jsoncpp CONFIG REQUIRED)
|
2019-08-09 22:38:28 +02:00
|
|
|
# Some distributions do not contain Poco*Config.cmake recipes.
|
|
|
|
find_package(Poco COMPONENTS Foundation Net NetSSL CONFIG)
|
2019-04-17 00:17:26 +02:00
|
|
|
|
2019-08-09 21:07:10 +02:00
|
|
|
add_subdirectory(src)
|
2019-04-17 00:17:26 +02:00
|
|
|
|
|
|
|
if (WITH_MAN)
|
2019-08-09 21:07:10 +02:00
|
|
|
add_subdirectory(man)
|
2019-04-17 00:17:26 +02:00
|
|
|
endif()
|
2019-04-20 13:01:58 +02:00
|
|
|
|
|
|
|
if(WITH_TESTS)
|
2019-08-09 21:07:10 +02:00
|
|
|
add_subdirectory(tests)
|
2019-04-20 13:01:58 +02:00
|
|
|
endif()
|