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
This commit is contained in:
Christoph Grüninger authored and Brad King committed 2023-09-22 10:11:22 -04:00
1 parent 62df021464
commit 59a4aaa237
1 file changed
+12 -9
+12 -9
View File
@@ -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()