Add Termcolor dependency and bundle it in dist/.

This commit is contained in:
tastytea 2021-05-25 10:55:44 +02:00
parent b557656649
commit d3c3062cc0
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
3 changed files with 14 additions and 1 deletions

View File

@ -13,6 +13,7 @@ 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)
@ -26,6 +27,14 @@ 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)
add_subdirectory(dist/termcolor)
else()
message(FATAL_ERROR "Termcolor was not found.")
endif()
endif()
add_subdirectory(src)

View File

@ -14,6 +14,7 @@
:uri-libarchive: https://www.libarchive.org/
:uri-fmt: https://github.com/fmtlib/fmt
:uri-asciidoc: http://asciidoc.org/
uri-termcolor: https://termcolor.readthedocs.io/
*{project}* is a search tool for EPUB e-books.
@ -49,6 +50,7 @@ image::https://repology.org/badge/vertical-allrepos/epubgrep.svg[]
* link:{uri-libarchive}[libarchive] (tested: 3.5 / 3.2)
* link:{uri-fmt}[fmt] (tested: 7.0 / 4.0)
* link:{uri-asciidoc}[AsciiDoc] (tested: 8.6 / 9.0)
* link:{uri-termcolor}[Termcolor] (tested: 2.0)
* Optional
** Tests: link:{uri-catch}[Catch] (tested: 2.13 / 1.10)
@ -79,5 +81,6 @@ cmake --build . -- --jobs=$(nproc --ignore=1)
* `-DCMAKE_BUILD_TYPE=Debug` for a debug build.
* `-DWITH_TESTS=YES` if you want to compile the tests.
* `-DXGETTEXT_CMD=String` The program to use instead of `xgettext`.
* `-DFALLBACK_BUNDLED=NO if you don't want to fall back on bundled libraries.
include::{uri-base}/raw/branch/main/CONTRIBUTING.adoc[]

View File

@ -21,7 +21,8 @@ target_link_libraries(${PROJECT_NAME}_lib
Boost::program_options
Boost::regex
std::filesystem
fmt::fmt)
fmt::fmt
termcolor::termcolor)
if(${CMAKE_VERSION} VERSION_LESS 3.17)
target_link_libraries(${PROJECT_NAME}_lib