From 59a4aaa2374d9ad20c3c8b5080b73d3cb760a03a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Gr=C3=BCninger?= Date: Tue, 19 Sep 2023 17:11:40 +0200 Subject: FindDoxygen: Disable Doxygen if executable returns non-zero result This makes detection of Doxygen more robust in case of broken Doxygen executables. Doxygen is called to determine its version number. If this call returns a non-zero result, we have an indication that the Doxygen executable is broken. We report Doxygen as not found to prevent issues with checks for other Doxygen component, that might lead to configuration aborts. Fixes: #18708 --- Modules/FindDoxygen.cmake | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/Modules/FindDoxygen.cmake b/Modules/FindDoxygen.cmake index 76f4759..7ea9d89 100644 --- a/Modules/FindDoxygen.cmake +++ b/Modules/FindDoxygen.cmake @@ -494,15 +494,18 @@ macro(_Doxygen_find_doxygen) _Doxygen_get_version(DOXYGEN_VERSION _Doxygen_version_result "${DOXYGEN_EXECUTABLE}") if(_Doxygen_version_result) - message(WARNING "Unable to determine doxygen version: ${_Doxygen_version_result}") - endif() - - # Create an imported target for Doxygen - if(NOT TARGET Doxygen::doxygen) - add_executable(Doxygen::doxygen IMPORTED GLOBAL) - set_target_properties(Doxygen::doxygen PROPERTIES - IMPORTED_LOCATION "${DOXYGEN_EXECUTABLE}" - ) + if(NOT Doxygen_FIND_QUIETLY) + message(WARNING "Doxygen executable failed unexpected while determining version (exit status: ${_Doxygen_version_result}). Disabling Doxygen.") + endif() + set(DOXYGEN_EXECUTABLE "${DOXYGEN_EXECUTABLE}-FAILED_EXECUTION-NOTFOUND") + else() + # Create an imported target for Doxygen + if(NOT TARGET Doxygen::doxygen) + add_executable(Doxygen::doxygen IMPORTED GLOBAL) + set_target_properties(Doxygen::doxygen PROPERTIES + IMPORTED_LOCATION "${DOXYGEN_EXECUTABLE}" + ) + endif() endif() endif() endmacro() -- cgit v0.12