54 lines
1.4 KiB
CMake
54 lines
1.4 KiB
CMake
cmake_minimum_required(VERSION 3.12...3.18)
|
|
|
|
# Global build options.
|
|
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "The type of build.")
|
|
set(XGETTEXT_CMD "xgettext" CACHE STRING "The command for xgettext.")
|
|
|
|
project(epubgrep
|
|
VERSION 0.3.0
|
|
DESCRIPTION "Search tool for EPUB e-books"
|
|
HOMEPAGE_URL "https://schlomp.space/tastytea/epubgrep"
|
|
LANGUAGES CXX)
|
|
|
|
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
|
|
|
|
# Project build options.
|
|
option(WITH_TESTS "Compile tests." NO)
|
|
option(FALLBACK_BUNDLED "Fall back to bundled libs." YES)
|
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
|
|
include(cmake/debug_flags.cmake)
|
|
|
|
# All dependencies except test dependencies.
|
|
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG TRUE)
|
|
find_package(Boost 1.65.0 REQUIRED COMPONENTS locale program_options regex)
|
|
find_package(Gettext REQUIRED)
|
|
find_package(Filesystem REQUIRED COMPONENTS Final Experimental)
|
|
find_package(LibArchive 3.2 REQUIRED)
|
|
find_package(fmt 4 REQUIRED CONFIG)
|
|
find_package(termcolor CONFIG)
|
|
if(NOT termcolor_FOUND)
|
|
if(FALLBACK_BUNDLED)
|
|
message(STATUS "Using bundled version of Termcolor.")
|
|
add_subdirectory(dist/termcolor EXCLUDE_FROM_ALL)
|
|
else()
|
|
message(FATAL_ERROR "Termcolor was not found.")
|
|
endif()
|
|
endif()
|
|
find_package(Threads REQUIRED)
|
|
|
|
add_subdirectory(src)
|
|
|
|
if(WITH_TESTS)
|
|
add_subdirectory(tests)
|
|
endif()
|
|
|
|
add_subdirectory(translations)
|
|
|
|
add_subdirectory(man)
|
|
|
|
include(cmake/packages.cmake)
|