From 7c19cb90e15d9e3d937c2360f67bc8ecfbdfda85 Mon Sep 17 00:00:00 2001 From: Julian Waller Date: Thu, 6 Jun 2024 13:54:11 +0000 Subject: [PATCH] cmake: Skip docs generation if the Doxyfile is missing The Doxyfile is not included with minimal distributions. --- CMakeLists.txt.in | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt.in b/CMakeLists.txt.in index 93b5f3e7b..27cc39810 100644 --- a/CMakeLists.txt.in +++ b/CMakeLists.txt.in @@ -240,16 +240,18 @@ PRINT_CEF_CONFIG() # Define the API documentation target. # -find_package(Doxygen) -if(DOXYGEN_FOUND) - add_custom_target(apidocs ALL - # Generate documentation in the docs/html directory. - COMMAND "${DOXYGEN_EXECUTABLE}" Doxyfile - # Write a docs/index.html file. - COMMAND ${CMAKE_COMMAND} -E echo "" > docs/index.html - WORKING_DIRECTORY "${CEF_ROOT}" - COMMENT "Generating API documentation with Doxygen..." - VERBATIM ) -else() - message(WARNING "Doxygen must be installed to generate API documentation.") -endif() +if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile") + find_package(Doxygen) + if(DOXYGEN_FOUND) + add_custom_target(apidocs ALL + # Generate documentation in the docs/html directory. + COMMAND "${DOXYGEN_EXECUTABLE}" Doxyfile + # Write a docs/index.html file. + COMMAND ${CMAKE_COMMAND} -E echo "" > docs/index.html + WORKING_DIRECTORY "${CEF_ROOT}" + COMMENT "Generating API documentation with Doxygen..." + VERBATIM ) + else() + message(WARNING "Doxygen must be installed to generate API documentation.") + endif() +endif() \ No newline at end of file