2019-10-30 04:47:38 +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)
|
2019-08-03 20:10:20 +02: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()
|
|
|
|
|
2019-11-06 12:06:37 +01:00
|
|
|
# Global build options.
|
|
|
|
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "The type of build.")
|
|
|
|
option(BUILD_SHARED_LIBS "Build shared libraries." YES)
|
|
|
|
option(HUNTER_ENABLED "Use the Hunter package manager" NO)
|
|
|
|
|
|
|
|
if(${HUNTER_ENABLED})
|
|
|
|
set(BUILD_SHARED_LIBS "NO")
|
|
|
|
set(HUNTER_PocoCpp_CMAKE_ARGS
|
|
|
|
ENABLE_CRYPTO=ON
|
|
|
|
ENABLE_DATA=ON
|
|
|
|
ENABLE_JSON=ON
|
|
|
|
ENABLE_NET=ON
|
|
|
|
ENABLE_NETSSL=ON
|
|
|
|
ENABLE_SQL_SQLITE=ON
|
|
|
|
ENABLE_UTIL=ON
|
|
|
|
ENABLE_XML=ON)
|
|
|
|
|
|
|
|
# FetchContent_MakeAvailable needs 3.14.
|
|
|
|
if(NOT (${CMAKE_VERSION} VERSION_LESS 3.14))
|
|
|
|
set(HUNTER_PACKAGES PocoCpp)
|
|
|
|
include(FetchContent)
|
|
|
|
FetchContent_Declare(SetupHunter GIT_REPOSITORY https://github.com/cpp-pm/gate)
|
|
|
|
FetchContent_MakeAvailable(SetupHunter)
|
|
|
|
else()
|
|
|
|
include("cmake/HunterGate.cmake")
|
|
|
|
HunterGate(
|
|
|
|
URL "https://github.com/cpp-pm/hunter/archive/v0.23.225.tar.gz"
|
|
|
|
SHA1 "4b018ec7b673817475c1fb9f0bd4dfb7c5e7f343"
|
|
|
|
LOCAL) # Load cmake/Hunter/config.cmake.
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2019-05-11 02:52:33 +02:00
|
|
|
project(remwharead
|
2019-10-15 16:01:18 +02:00
|
|
|
VERSION 0.8.5
|
2019-11-06 12:06:37 +01:00
|
|
|
DESCRIPTION "Saves URIs of things you want to remember in a database.")
|
2019-08-03 20:10:20 +02:00
|
|
|
|
2019-11-06 12:06:37 +01:00
|
|
|
if(${HUNTER_ENABLED} AND ${CMAKE_VERSION} VERSION_LESS 3.14)
|
|
|
|
hunter_add_package(PocoCpp)
|
|
|
|
endif()
|
2019-10-30 05:26:48 +01:00
|
|
|
|
2019-11-06 12:06:37 +01:00
|
|
|
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
|
2019-08-03 20:10:20 +02:00
|
|
|
include(GNUInstallDirs)
|
|
|
|
|
2019-11-06 12:06:37 +01:00
|
|
|
# Project build options.
|
2019-08-03 20:10:20 +02:00
|
|
|
option(WITH_MAN "Compile and install manpage." YES)
|
|
|
|
option(WITH_TESTS "Compile tests." NO)
|
|
|
|
option(WITH_MOZILLA "Build and install wrapper for Mozilla browsers." YES)
|
2019-08-09 12:45:02 +02:00
|
|
|
set(MOZILLA_NMH_DIR "${CMAKE_INSTALL_LIBDIR}/mozilla/native-messaging-hosts"
|
|
|
|
CACHE STRING "Directory for the Mozilla extension wrapper.")
|
2019-05-11 02:52:33 +02:00
|
|
|
|
2019-10-30 07:49:12 +01:00
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
2019-05-11 02:52:33 +02:00
|
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
|
|
|
2019-10-30 05:26:48 +01:00
|
|
|
include(debug_flags)
|
2019-05-11 02:52:33 +02:00
|
|
|
|
2019-08-03 20:10:20 +02:00
|
|
|
add_subdirectory(src)
|
2019-07-26 07:08:13 +02:00
|
|
|
add_subdirectory(src/lib)
|
2019-08-03 20:10:20 +02:00
|
|
|
add_subdirectory(include)
|
2019-07-26 07:08:13 +02:00
|
|
|
add_subdirectory(src/cli)
|
2019-08-03 20:10:20 +02:00
|
|
|
add_subdirectory(pkg-config)
|
|
|
|
add_subdirectory(cmake)
|
2019-05-11 02:52:33 +02:00
|
|
|
|
2019-10-30 04:58:59 +01:00
|
|
|
if(WITH_MAN)
|
2019-08-03 20:10:20 +02:00
|
|
|
add_subdirectory(man)
|
2019-05-11 02:52:33 +02:00
|
|
|
endif()
|
|
|
|
|
2019-10-30 04:58:59 +01:00
|
|
|
if(WITH_MOZILLA)
|
2019-05-21 13:05:17 +02:00
|
|
|
add_subdirectory(browser-plugins/webextension/native-wrapper)
|
2019-05-21 09:42:58 +02:00
|
|
|
endif()
|
|
|
|
|
2019-05-11 02:52:33 +02:00
|
|
|
if(WITH_TESTS)
|
2019-05-21 19:49:31 +02:00
|
|
|
add_subdirectory(tests)
|
2019-05-11 02:52:33 +02:00
|
|
|
endif()
|
2019-05-18 05:09:56 +02:00
|
|
|
|
2019-08-06 12:47:45 +02:00
|
|
|
include(cmake/packages.cmake)
|