FindDoxygen: Makes USES_TERMINAL compatible with USE_STAMP_FILE

Fixes: #28238
This commit is contained in:
James Miro authored and Brad King committed 2026-11-03 09:03:57 -05:00
1 parent 9e1c78ad92
commit 6c4a0d284e
2 files changed
+38 -2

No files matched your search

+1 -2
View File
@@ -1559,12 +1559,11 @@ doxygen_add_docs() for target ${targetName}")
add_custom_target(${targetName}
${_all}
DEPENDS ${__stamp_file}
${_uses_terminal}
SOURCES ${_sources}
)
unset(__stamp_file)
else()
add_custom_target( ${targetName}
add_custom_target(${targetName}
${_all}
VERBATIM
COMMAND ${CMAKE_COMMAND} -E make_directory ${_doxygen_resolved_output_dirs}
@@ -4,31 +4,66 @@ project(TestFindDoxygen VERSION 1.0 LANGUAGES NONE)
find_package(Doxygen REQUIRED)
set(DOXYGEN_OUTPUT_DIRECTORY noFiles)
doxygen_add_docs(docsWithoutFilesWithStamp USE_STAMP_FILE)
if(NOT EXISTS "${PROJECT_BINARY_DIR}/Doxyfile.docsWithoutFilesWithStamp")
message(FATAL_ERROR "Missing generated file: Doxyfile.docsWithoutFilesWithStamp")
endif()
if(NOT TARGET docsWithoutFilesWithStamp)
message(FATAL_ERROR "Target docsWithoutFilesWithStamp not created")
endif()
set(DOXYGEN_OUTPUT_DIRECTORY withFiles)
doxygen_add_docs(docsWithFilesWithStamp main.cpp main2.cpp USE_STAMP_FILE)
if(NOT EXISTS "${PROJECT_BINARY_DIR}/Doxyfile.docsWithFilesWithStamp")
message(FATAL_ERROR "Missing generated file: Doxyfile.docsWithFilesWithStamp")
endif()
if(NOT TARGET docsWithFilesWithStamp)
message(FATAL_ERROR "Target docsWithFilesWithStamp not created")
endif()
# Confirm that USE_STAMP_FILE and USES_TERMINAL are compatible
set(DOXYGEN_OUTPUT_DIRECTORY noFilesUsesTerminal)
doxygen_add_docs(docsWithoutFilesWithStampUsesTerminal USE_STAMP_FILE USES_TERMINAL)
if(NOT EXISTS "${PROJECT_BINARY_DIR}/Doxyfile.docsWithoutFilesWithStampUsesTerminal")
message(FATAL_ERROR "Missing generated file: Doxyfile.docsWithoutFilesWithStampUsesTerminal")
endif()
if(NOT TARGET docsWithoutFilesWithStampUsesTerminal)
message(FATAL_ERROR "Target docsWithoutFilesWithStampUsesTerminal not created")
endif()
set(DOXYGEN_OUTPUT_DIRECTORY withFiles)
doxygen_add_docs(docsWithFilesWithStampUsesTerminal main.cpp main2.cpp USE_STAMP_FILE USES_TERMINAL)
if(NOT EXISTS "${PROJECT_BINARY_DIR}/Doxyfile.docsWithFilesWithStampUsesTerminal")
message(FATAL_ERROR "Missing generated file: Doxyfile.docsWithFilesWithStampUsesTerminal")
endif()
if(NOT TARGET docsWithFilesWithStampUsesTerminal)
message(FATAL_ERROR "Target docsWithFilesWithStampUsesTerminal not created")
endif()
# Confirm that doxygen_add_docs() doesn't cause a fatal error if given a
# source file that is generated at build time
file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/genDox.cpp)
add_custom_command(OUTPUT genDox.cpp
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/main2.cpp genDox.cpp
DEPENDS main2.cpp
)
set(DOXYGEN_OUTPUT_DIRECTORY withGenFiles)
doxygen_add_docs(docsWithGenFilesWithStamp
main.cpp
${CMAKE_CURRENT_BINARY_DIR}/genDox.cpp
@@ -40,4 +75,6 @@ add_dependencies(allDocTargets
docsWithoutFilesWithStamp
docsWithFilesWithStamp
docsWithGenFilesWithStamp
docsWithoutFilesWithStampUsesTerminal
docsWithFilesWithStampUsesTerminal
)