Browse Source

cmake ignore doxygen option when not a standalone build (#488)

master
Daniel Agar 7 years ago committed by GitHub
parent
commit
48a17b5234
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 50
      CMakeLists.txt

50
CMakeLists.txt

@ -191,29 +191,33 @@ endif()
#============================================================================= #=============================================================================
# Doxygen # Doxygen
# #
option(BUILD_DOXYGEN "Build doxygen documentation" OFF) # Only in standalone build
if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
if (BUILD_DOXYGEN)
find_package(Doxygen)
if (DOXYGEN_FOUND)
# set input and output files
set(DOXYGEN_IN ${CMAKE_SOURCE_DIR}/docs/Doxyfile.in)
set(DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
# request to configure the file
configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY)
# note the option ALL which allows to build the docs together with the application
add_custom_target(doxygen ALL
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating documentation with Doxygen"
DEPENDS
VERBATIM
USES_TERMINAL
)
else() option(BUILD_DOXYGEN "Build doxygen documentation" OFF)
message(FATAL_ERROR "Doxygen needs to be installed to generate documentation")
if (BUILD_DOXYGEN)
find_package(Doxygen)
if (DOXYGEN_FOUND)
# set input and output files
set(DOXYGEN_IN ${CMAKE_CURRENT_SOURCE_DIR}/docs/Doxyfile.in)
set(DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
# request to configure the file
configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY)
# note the option ALL which allows to build the docs together with the application
add_custom_target(doxygen ALL
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating documentation with Doxygen"
DEPENDS
VERBATIM
USES_TERMINAL
)
else()
message(FATAL_ERROR "Doxygen needs to be installed to generate documentation")
endif()
endif() endif()
endif() endif()

Loading…
Cancel
Save