Skip to content

Commit 34a309e

Browse files
committed
build: add support to auto-install doxygen if not found
1 parent 1e4ac70 commit 34a309e

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

.github/workflows/build.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,6 @@ jobs:
105105
- name: Checkout repository
106106
uses: actions/checkout@v3.5.3
107107

108-
- name: Install requirements
109-
run: |
110-
sudo apt-get install -y doxygen
111-
112108
- name: Configure and build documentation
113109
uses: threeal/cmake-action@v1.2.0
114110
with:

error/cmake/target_generate_xml_docs.cmake

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
1-
# A function that generates XML documentation from the specified target.
1+
# A function that generates XML documentation for the specified target.
22
function(target_generate_xml_docs TARGET)
3+
# Try to install Doxygen if not found
4+
find_program(DOXYGEN_PROGRAM doxygen)
5+
if(NOT DOXYGEN_PROGRAM)
6+
find_program(APT_GET_PROGRAM apt-get)
7+
if(APT_GET_PROGRAM)
8+
message(STATUS "Doxygen could not be found, installing...")
9+
execute_process(COMMAND ${APT_GET_PROGRAM} install -y doxygen)
10+
endif()
11+
12+
find_program(BREW_PROGRAM brew)
13+
if(BREW_PROGRAM)
14+
message(STATUS "Doxygen could not be found, installing...")
15+
execute_process(COMMAND ${BREW_PROGRAM} install doxygen)
16+
endif()
17+
endif()
18+
319
# Try to find Doxygen
420
find_package(Doxygen)
521
if(DOXYGEN_FOUND)
@@ -25,7 +41,5 @@ function(target_generate_xml_docs TARGET)
2541
# Generate XML documentation for the target
2642
doxygen_add_docs(${TARGET}_docs ${HEADER_FILES} USE_STAMP_FILE)
2743
add_dependencies(${TARGET} ${TARGET}_docs)
28-
else()
29-
message(WARNING "Could not found Doxygen!")
3044
endif()
3145
endfunction()

0 commit comments

Comments
 (0)