Skip to content

Commit 0e30518

Browse files
committed
updated doc generation/install
1 parent c5bd044 commit 0e30518

File tree

3 files changed

+22
-16
lines changed

3 files changed

+22
-16
lines changed

CMakeLists.txt

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,18 @@ cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
1010
project(
1111
InfoLogger
1212
DESCRIPTION "O2 Logging library and services"
13-
LANGUAGES CXX C
13+
LANGUAGES NONE
1414
)
1515

16-
# default install dirs
17-
include(GNUInstallDirs)
18-
19-
# add subdirectories
20-
add_subdirectory(doc)
21-
# stop immediately for easy building of doc only
16+
# simplified build mode for doc only
2217
if(ONLYDOC)
18+
add_subdirectory(doc)
2319
return()
2420
endif()
2521

2622
# global compilation options
23+
enable_language(C)
24+
enable_language(CXX)
2725
set(CMAKE_CXX_STANDARD 14)
2826
set(CMAKE_CXX_STANDARD_REQUIRED ON)
2927
set(CMAKE_CXX_EXTENSIONS OFF)
@@ -33,11 +31,15 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
3331
# build-time binaries
3432
set(EXECUTABLE_OUTPUT_PATH "${CMAKE_BINARY_DIR}/bin")
3533
# installation
34+
include(GNUInstallDirs)
3635
set(CMAKE_INSTALL_LIBDIR lib)
3736

3837
# add local modules directory
3938
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
4039

40+
# add subdirectories
41+
add_subdirectory(doc)
42+
4143
# dependencies to build the InfoLogger components
4244
# NB: cmake/InfoLoggerConfig.cmake defines dependencies for clients using the library
4345
#find_package(Common REQUIRED)

doc/CMakeLists.txt

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
1-
include(FindDoxygen)
1+
# Generate documentation
2+
3+
# define doc build path
4+
set(DOC_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/doc-build")
25

3-
# put doc in a subdirectory with project name, if not already set so
6+
# define doc installation path
7+
# ensures it ends with project name
48
if (NOT CMAKE_INSTALL_DOCDIR)
59
set(CMAKE_INSTALL_DOCDIR "doc")
610
endif()
711
if (NOT "${CMAKE_INSTALL_DOCDIR}" MATCHES "${PROJECT_NAME}$")
812
set(CMAKE_INSTALL_DOCDIR "${CMAKE_INSTALL_DOCDIR}/${PROJECT_NAME}")
913
endif()
10-
set(DOC_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_INSTALL_DOCDIR}")
1114

1215
# log doc build(install paths)
13-
message(STATUS "Documentation will be generated in ${DOC_OUTPUT_DIR}")
14-
message(STATUS "Documentation will be installed in ${CMAKE_INSTALL_DOCDIR}")
16+
message(STATUS "Documentation will be built in ${DOC_BUILD_DIR}")
17+
message(STATUS "Documentation will be installed in ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DOCDIR}")
1518

1619
# general files directly from source
1720
install(
@@ -21,6 +24,7 @@ install(
2124
)
2225

2326
# doxygen-generated files
27+
include(FindDoxygen)
2428
if (DOXYGEN_FOUND)
2529
if(NOT DOXYGEN_DOT_FOUND)
2630
message(WARNING "dot not found. Please install Graphviz.")
@@ -42,19 +46,19 @@ if (DOXYGEN_FOUND)
4246
# doxygen fails creating multi-level output directory, make sure it exists
4347
add_custom_target(
4448
doc-dir
45-
COMMAND ${CMAKE_COMMAND} -E make_directory "${DOC_OUTPUT_DIR}"
49+
COMMAND ${CMAKE_COMMAND} -E make_directory "${DOC_BUILD_DIR}"
4650
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
4751
COMMENT "Create the doxygen output directory"
4852
VERBATIM
4953
)
5054

5155
# install generated files
5256
install(
53-
DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_INSTALL_DOCDIR}/html
57+
DIRECTORY ${DOC_BUILD_DIR}/html
5458
TYPE DOC
5559
OPTIONAL # because available only after "make doc"
5660
)
57-
else (DO)
61+
else ()
5862
message(WARNING "Doxygen not found")
5963
endif (DOXYGEN_FOUND)
6064

doc/doxyfile.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ PROJECT_LOGO =
5858
# entered, it will be relative to the location where doxygen was started. If
5959
# left blank the current directory will be used.
6060

61-
OUTPUT_DIRECTORY = "@DOC_OUTPUT_DIR@"
61+
OUTPUT_DIRECTORY = "@DOC_BUILD_DIR@"
6262

6363
# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 4096 sub-
6464
# directories (in 2 levels) under the output directory of each output format and

0 commit comments

Comments
 (0)