Skip to content

Commit af1d903

Browse files
authored
docs: add install instructions for CMake FetchContent (#161)
1 parent 568f56c commit af1d903

File tree

1 file changed

+36
-3
lines changed

1 file changed

+36
-3
lines changed

README.md

+36-3
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ This can be done in several ways:
4949

5050
- manually copying the files
5151
- adding the project as a Git submodule
52+
- downloading the project with CMake FetchContent
5253
- adding the project as a npm/xpm dependency
5354
- installing the theme system-wide
5455

@@ -63,6 +64,38 @@ cd doxygen-awesome-css
6364
git checkout v2.3.4
6465
```
6566

67+
### CMake with FetchContent
68+
69+
For project that build with CMake, the `FetchContent` module can be used to download the repository at configure-time.
70+
71+
Add the following snippet to your `CMakeLists.txt`
72+
73+
```cmake
74+
include(FetchContent)
75+
FetchContent_Declare(
76+
doxygen-awesome-css
77+
URL https://github.com/jothepro/doxygen-awesome-css/archive/refs/heads/main.zip
78+
)
79+
FetchContent_MakeAvailable(doxygen-awesome-css)
80+
81+
# Save the location the files were cloned into
82+
# This allows us to get the path to doxygen-awesome.css
83+
FetchContent_GetProperties(doxygen-awesome-css SOURCE_DIR AWESOME_CSS_DIR)
84+
85+
# Generate the Doxyfile
86+
set(DOXYFILE_IN ${CMAKE_CURRENT_SOURCE_DIR}/doc/Doxyfile.in)
87+
set(DOXYFILE_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
88+
configure_file(${DOXYFILE_IN} ${DOXYFILE_OUT} @ONLY)
89+
```
90+
91+
This downloads the latest main (but any other revision could be used) and unpacks in the build folder. The `Doxyfile.in` can reference this location in the `HTML_EXTRA_STYLESHEET` field
92+
93+
```text
94+
HTML_EXTRA_STYLESHEET = @AWESOME_CSS_DIR@/doxygen-awesome.css
95+
```
96+
97+
When the configure stage of CMake is run, the `Doxyfile.in` is rendered to Doxyfile and Doxygen can be run as usual.
98+
6699
### npm/xpm dependency
67100

68101
In the npm ecosystem, this project can be added as a development dependency
@@ -81,8 +114,8 @@ managed project.
81114

82115
### System-wide
83116

84-
You can even install the theme system-wide by running `make install`.
85-
The files will be installed to `/usr/local/share/` by default,
117+
You can even install the theme system-wide by running `make install`.
118+
The files will be installed to `/usr/local/share/` by default,
86119
but you can customize the install location with `make PREFIX=/my/custom/path install`.
87120

88121
### Choosing a layout
@@ -94,7 +127,7 @@ There are two layout options. Choose one of them and configure Doxygen according
94127
- <b class="tab-title">Base Theme</b><div class="darkmode_inverted_image">
95128
![](img/theme-variants-base.drawio.svg)
96129
</div>
97-
Comes with the typical Doxygen titlebar. Optionally the treeview in the sidebar can be enabled.
130+
Comes with the typical Doxygen titlebar. Optionally the treeview in the sidebar can be enabled.
98131

99132
Required files: `doxygen-awesome.css`
100133

0 commit comments

Comments
 (0)