Skip to content

Commit 7a2584b

Browse files
committed
cmake: fix Doxygen documentation generation + install html & man pages
1 parent 8e4c044 commit 7a2584b

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

CMakeLists.txt

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -283,17 +283,31 @@ if(PHYSFS_BUILD_DOCS)
283283
file(APPEND "${PHYSFS_OUTPUT_DOXYFILE}" "\n\n# Below auto-generated by cmake...\n\n")
284284
file(APPEND "${PHYSFS_OUTPUT_DOXYFILE}" "PROJECT_NUMBER = \"${PHYSFS_VERSION}\"\n")
285285
file(APPEND "${PHYSFS_OUTPUT_DOXYFILE}" "OUTPUT_DIRECTORY = \"${CMAKE_CURRENT_BINARY_DIR}/docs\"\n")
286+
file(APPEND "${PHYSFS_OUTPUT_DOXYFILE}" "INPUT = \"${CMAKE_CURRENT_SOURCE_DIR}/include\"\n")
286287
file(APPEND "${PHYSFS_OUTPUT_DOXYFILE}" "\n# End auto-generated section.\n\n")
287288

288289
set(PHYSFS_TARGETNAME_DOCS "docs" CACHE STRING "Name of 'docs' build target")
289290

290-
add_custom_target(
291-
${PHYSFS_TARGETNAME_DOCS}
292-
${DOXYGEN_EXECUTABLE} "${PHYSFS_OUTPUT_DOXYFILE}"
293-
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
291+
add_custom_command(
292+
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/docs/html/index.html"
293+
COMMAND ${DOXYGEN_EXECUTABLE} "${PHYSFS_OUTPUT_DOXYFILE}"
294294
COMMENT "Building documentation in 'docs' directory..."
295+
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/include/physfs.h" "${CMAKE_CURRENT_SOURCE_DIR}/docs/Doxyfile"
295296
)
296297

298+
add_custom_target(${PHYSFS_TARGETNAME_DOCS} ALL
299+
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/docs/html/index.html"
300+
)
301+
302+
if(NOT PHYSFS_DISABLE_INSTALL)
303+
install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/docs/html"
304+
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/doc/physfs"
305+
)
306+
install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/docs/man"
307+
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}"
308+
)
309+
endif()
310+
297311
else()
298312
message(STATUS "Doxygen not found. You won't be able to build documentation.")
299313
endif()

0 commit comments

Comments
 (0)