2021-05-25 07:30:34 +02:00
|
|
|
cmake_minimum_required(VERSION 3.12...3.18)
|
2021-05-20 04:30:31 +02:00
|
|
|
|
|
|
|
# Global build options.
|
|
|
|
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "The type of build.")
|
2021-05-20 07:07:47 +02:00
|
|
|
set(XGETTEXT_CMD "xgettext" CACHE STRING "The command for xgettext.")
|
2021-05-20 04:30:31 +02:00
|
|
|
|
|
|
|
project(epubgrep
|
2021-05-27 21:50:51 +02:00
|
|
|
VERSION 0.3.1
|
2021-05-25 08:12:18 +02:00
|
|
|
DESCRIPTION "Search tool for EPUB e-books"
|
2021-05-26 10:18:28 +02:00
|
|
|
HOMEPAGE_URL "https://schlomp.space/tastytea/epubgrep"
|
2021-05-20 04:30:31 +02:00
|
|
|
LANGUAGES CXX)
|
|
|
|
|
|
|
|
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
|
|
|
|
|
|
|
|
# Project build options.
|
|
|
|
option(WITH_TESTS "Compile tests." NO)
|
2021-05-25 10:55:44 +02:00
|
|
|
option(FALLBACK_BUNDLED "Fall back to bundled libs." YES)
|
2021-05-20 04:30:31 +02:00
|
|
|
|
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
|
|
|
|
|
|
include(cmake/debug_flags.cmake)
|
|
|
|
|
2021-05-23 09:30:33 +02:00
|
|
|
# All dependencies except test dependencies.
|
2021-05-26 10:48:11 +02:00
|
|
|
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG TRUE)
|
2021-05-24 15:35:49 +02:00
|
|
|
find_package(Boost 1.65.0 REQUIRED COMPONENTS locale program_options regex)
|
2021-05-20 07:07:47 +02:00
|
|
|
find_package(Gettext REQUIRED)
|
2021-05-20 10:30:36 +02:00
|
|
|
find_package(Filesystem REQUIRED COMPONENTS Final Experimental)
|
2021-05-23 09:30:33 +02:00
|
|
|
find_package(LibArchive 3.2 REQUIRED)
|
|
|
|
find_package(fmt 4 REQUIRED CONFIG)
|
2021-05-25 10:55:44 +02:00
|
|
|
find_package(termcolor CONFIG)
|
|
|
|
if(NOT termcolor_FOUND)
|
|
|
|
if(FALLBACK_BUNDLED)
|
2021-05-26 10:48:11 +02:00
|
|
|
message(STATUS "Using bundled version of Termcolor.")
|
2021-05-25 11:42:57 +02:00
|
|
|
add_subdirectory(dist/termcolor EXCLUDE_FROM_ALL)
|
2021-05-25 10:55:44 +02:00
|
|
|
else()
|
|
|
|
message(FATAL_ERROR "Termcolor was not found.")
|
|
|
|
endif()
|
|
|
|
endif()
|
2021-05-26 17:23:53 +02:00
|
|
|
find_package(Threads REQUIRED)
|
2021-05-20 04:30:31 +02:00
|
|
|
|
|
|
|
add_subdirectory(src)
|
|
|
|
|
|
|
|
if(WITH_TESTS)
|
|
|
|
add_subdirectory(tests)
|
|
|
|
endif()
|
2021-05-20 07:07:47 +02:00
|
|
|
|
|
|
|
add_subdirectory(translations)
|
2021-05-23 06:35:04 +02:00
|
|
|
|
|
|
|
add_subdirectory(man)
|
2021-05-26 10:18:45 +02:00
|
|
|
|
|
|
|
include(cmake/packages.cmake)
|