diff --git a/CMakeLists.txt b/CMakeLists.txt index 7073a0b..ad574a2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -60,7 +60,7 @@ if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) endif() endif() - if(CMAKE_VERSION VERSION_GREATER 3.6) + if(NOT CMAKE_VERSION VERSION_LESS 3.6) # Add clang-tidy if available option(CLANG_TIDY_FIX "Perform fixes for Clang-Tidy" OFF) find_program( @@ -77,6 +77,17 @@ if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) endif() endif() endif() + + if(NOT CMAKE_VERSION VERSION_LESS 3.9) + find_package(Doxygen) + if(Doxygen_FOUND) + add_subdirectory(docs) + else() + message(STATUS "Doxygen not found, not building docs") + endif() + else() + message(STATUS "Newer CMake adds Doxygen support, update CMake for docs") + endif() else() set(CUR_PROJ OFF) endif() diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt new file mode 100644 index 0000000..f98ff35 --- /dev/null +++ b/docs/CMakeLists.txt @@ -0,0 +1,18 @@ +set(DOXYGEN_EXTRACT_ALL YES) +set(DOXYGEN_BUILTIN_STL_SUPPORT YES) +set(PROJECT_BRIEF "C++11 Command Line Interface Parser") + +file(GLOB DOC_LIST + RELATIVE "${PROJECT_SOURCE_DIR}/include" + "${PROJECT_SOURCE_DIR}/include/CLI/*.hpp" + ) + +doxygen_add_docs(docs + ${DOC_LIST} + "${CMAKE_CURRENT_SOURCE_DIR}/mainpage.md" + WORKING_DIRECTORY + "${PROJECT_SOURCE_DIR}/include" +) + + + diff --git a/docs/Doxyfile b/docs/Doxyfile index 5363a26..06de304 100644 --- a/docs/Doxyfile +++ b/docs/Doxyfile @@ -1,5 +1,7 @@ # Doxyfile 1.8.13 +# Designed to be run from the main directory with `doxygen docs/Doxygen` + # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project. # @@ -790,7 +792,7 @@ WARN_LOGFILE = # spaces. See also FILE_PATTERNS and EXTENSION_MAPPING # Note: If this tag is empty the current directory is searched. -INPUT = ../include mainpage.md +INPUT = include docs/mainpage.md # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses @@ -982,7 +984,7 @@ FILTER_SOURCE_PATTERNS = # (index.html). This can be useful if you have a project on for instance GitHub # and want to reuse the introduction page also for the doxygen output. -USE_MDFILE_AS_MAINPAGE = mainpage.md +USE_MDFILE_AS_MAINPAGE = docs/mainpage.md #--------------------------------------------------------------------------- # Configuration options related to source browsing diff --git a/docs/mainpage.md b/docs/mainpage.md index 149f729..b9e2d33 100644 --- a/docs/mainpage.md +++ b/docs/mainpage.md @@ -1,6 +1,6 @@ -# Introduction +# Introduction {#mainpage} -This is the Doxygen API documentation for CLI11 parser. There is a friendly introduction to CLI11 on the [Github page](https://github.com/CLIUtils/CLI11), and [a tutorial series](https://cliutils.github.io/CLI11/book). +This is the Doxygen API documentation for CLI11 parser. There is a friendly introduction to CLI11 on the [Github page](https://github.com/CLIUtils/CLI11), and [a tutorial series](https://cliutils.github.io/CLI11/book/). The main classes are: