Skip to content

Commit 8017cb4

Browse files
authored
Added standalone doc build and target for integration with flp-mkdocs (#246)
1 parent ac6cf6a commit 8017cb4

File tree

2 files changed

+40
-1
lines changed

2 files changed

+40
-1
lines changed

CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ project(Monitoring
2525
# Documentation dir
2626
add_subdirectory(doc)
2727

28+
# simplified build mode for doc only
29+
if(ONLYDOC)
30+
return()
31+
endif()
32+
2833
# Add compiler flags for warnings and debug symbols
2934
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -Wextra -DBOOST_SYSTEM_NO_DEPRECATED -DBOOST_ERROR_CODE_HEADER_ONLY")
3035

doc/CMakeLists.txt

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,24 @@
11
# @author Barthélémy von Haller
22
# @author Adam Wegrzynek
3+
# @author Sylvain Chapeland
34

5+
# define doc build path
6+
set(DOC_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/doc-build")
7+
8+
# define doc installation path
9+
# ensures it ends with project name
10+
if (NOT CMAKE_INSTALL_DOCDIR)
11+
set(CMAKE_INSTALL_DOCDIR "doc")
12+
endif()
13+
if (NOT "${CMAKE_INSTALL_DOCDIR}" MATCHES "${PROJECT_NAME}$")
14+
set(CMAKE_INSTALL_DOCDIR "${CMAKE_INSTALL_DOCDIR}/${PROJECT_NAME}")
15+
endif()
16+
17+
# log doc build/install paths
18+
message(STATUS "Documentation will be built in ${DOC_BUILD_DIR}")
19+
message(STATUS "Documentation will be installed in ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DOCDIR}")
20+
21+
# doxygen-generated doc
422
find_package(Doxygen OPTIONAL_COMPONENTS dot)
523
if (DOXYGEN_FOUND)
624
set(DOXYGEN_USE_MDFILE_AS_MAINPAGE "${CMAKE_SOURCE_DIR}/README.md")
@@ -16,10 +34,26 @@ if (DOXYGEN_FOUND)
1634
set(DOXYGEN_INTERACTIVE_SVG YES)
1735
set(DOXYGEN_DOT_GRAPH_MAX_NODES 100)
1836
set(DOXYGEN_DOT_TRANSPARENT YES)
19-
37+
set(DOXYGEN_OUTPUT_DIRECTORY ${DOC_BUILD_DIR})
38+
2039
doxygen_add_docs(doc
2140
${CMAKE_SOURCE_DIR}
2241
COMMENT "Generating doxygen documentation for ${PROJECT_NAME}"
2342
)
2443

44+
# install generated files
45+
install(
46+
DIRECTORY ${DOC_BUILD_DIR}/html
47+
TYPE DOC
48+
OPTIONAL # because available only after "make doc"
49+
)
50+
2551
endif (DOXYGEN_FOUND)
52+
53+
54+
# if needed add other doc files from source tree
55+
# install(
56+
# DIRECTORY .
57+
# TYPE DOC
58+
# FILES_MATCHING PATTERN "*.md" "*.png"
59+
#)

0 commit comments

Comments
 (0)