From ddfec6fc8fad0142e7a5cedbba00c5bf2332dbc0 Mon Sep 17 00:00:00 2001 From: patrick96 Date: Tue, 22 Dec 2020 12:29:26 +0100 Subject: [PATCH] build: Add option to enable/disable html/manpages --- CHANGELOG.md | 2 ++ cmake/01-core.cmake | 4 ++++ cmake/05-summary.cmake | 2 ++ doc/CMakeLists.txt | 8 +++++++- 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6128f099..b719edf6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `BUILD_POLYBAR_MSG=ON` - Builds the `polybar-msg` executable - `BUILD_TESTS=OFF` - Builds the test suite - `BUILD_DOC=ON` - Builds the documentation + - `BUILD_DOC_HTML=BUILD_DOC` - Builds the html documentation (depends on `BUILD_DOC`) + - `BUILD_DOC_MAN=BUILD_DOC` - Builds the manpages (depends on `BUILD_DOC`) - `DISABLE_ALL=OFF` - Disables all above targets by default. Individual targets can still be enabled explicitly. - The documentation can no longer be built by directly configuring the `doc` diff --git a/cmake/01-core.cmake b/cmake/01-core.cmake index 27980a1b..4c94f1fd 100644 --- a/cmake/01-core.cmake +++ b/cmake/01-core.cmake @@ -16,6 +16,10 @@ option(BUILD_POLYBAR_MSG "Build polybar-msg" ${DEFAULT_ON}) option(BUILD_TESTS "Build testsuite" OFF) option(BUILD_DOC "Build documentation" ${DEFAULT_ON}) +include(CMakeDependentOption) +CMAKE_DEPENDENT_OPTION(BUILD_DOC_HTML "Build HTML documentation" ON "BUILD_DOC" OFF) +CMAKE_DEPENDENT_OPTION(BUILD_DOC_MAN "Build manpages" ON "BUILD_DOC" OFF) + if (BUILD_POLYBAR OR BUILD_TESTS) set(BUILD_LIBPOLY ON) else() diff --git a/cmake/05-summary.cmake b/cmake/05-summary.cmake index 70e10d86..61d24c3e 100644 --- a/cmake/05-summary.cmake +++ b/cmake/05-summary.cmake @@ -25,6 +25,8 @@ colored_option(" polybar" BUILD_POLYBAR) colored_option(" polybar-msg" BUILD_POLYBAR_MSG) colored_option(" testsuite" BUILD_TESTS) colored_option(" documentation" BUILD_DOC) +colored_option(" html" BUILD_DOC_HTML) +colored_option(" man" BUILD_DOC_MAN) if (BUILD_LIBPOLY) message(STATUS " Module support:") diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 59a15396..006eaf97 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -15,7 +15,13 @@ set(doc_path "${CMAKE_CURRENT_SOURCE_DIR}") configure_file(conf.py conf.py @ONLY) # We want to run `sphinx-build` with the following builders -set(doc_builders "html" "man") +if (BUILD_DOC_HTML) + list(APPEND doc_builders "html") +endif() + +if (BUILD_DOC_MAN) + list(APPEND doc_builders "man") +endif() # Name of all documentation targets set(doc_targets "")