cmake/Tests/FindDoxygen/StampFile/CMakeLists.txt

44 lines
1.5 KiB
CMake
Raw Normal View History

2020-02-01 23:06:01 +01:00
cmake_minimum_required(VERSION 3.8)
project(TestFindDoxygen VERSION 1.0 LANGUAGES NONE)
find_package(Doxygen REQUIRED)
2020-08-30 11:54:41 +02:00
set(DOXYGEN_OUTPUT_DIRECTORY noFiles)
2020-02-01 23:06:01 +01:00
doxygen_add_docs(docsWithoutFilesWithStamp USE_STAMP_FILE)
if(NOT EXISTS "${PROJECT_BINARY_DIR}/Doxyfile.docsWithoutFilesWithStamp")
2020-08-30 11:54:41 +02:00
message(FATAL_ERROR "Missing generated file: Doxyfile.docsWithoutFilesWithStamp")
2020-02-01 23:06:01 +01:00
endif()
if(NOT TARGET docsWithoutFilesWithStamp)
2020-08-30 11:54:41 +02:00
message(FATAL_ERROR "Target docsWithoutFilesWithStamp not created")
2020-02-01 23:06:01 +01:00
endif()
2020-08-30 11:54:41 +02:00
set(DOXYGEN_OUTPUT_DIRECTORY withFiles)
2020-02-01 23:06:01 +01:00
doxygen_add_docs(docsWithFilesWithStamp main.cpp main2.cpp USE_STAMP_FILE)
if(NOT EXISTS "${PROJECT_BINARY_DIR}/Doxyfile.docsWithFilesWithStamp")
2020-08-30 11:54:41 +02:00
message(FATAL_ERROR "Missing generated file: Doxyfile.docsWithFilesWithStamp")
2020-02-01 23:06:01 +01:00
endif()
if(NOT TARGET docsWithFilesWithStamp)
2020-08-30 11:54:41 +02:00
message(FATAL_ERROR "Target docsWithFilesWithStamp not created")
2020-02-01 23:06:01 +01:00
endif()
2020-08-30 11:54:41 +02:00
# 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
USE_STAMP_FILE
)
2020-02-01 23:06:01 +01:00
add_custom_target(allDocTargets)
2020-08-30 11:54:41 +02:00
add_dependencies(allDocTargets
docsWithoutFilesWithStamp
docsWithFilesWithStamp
docsWithGenFilesWithStamp
)