I am trying to use CMake for Doxygen generated documentation. This is what my CMakeList.txt looks like:
if (DOXYGEN_FOUND) # set input and output files set(DOXYGEN_IN ${CMAKE_CURRENT_SOURCE_DIR}/config-file) set(DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}doc) # request to configure the file configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY) message("Doxygen build started") # note the option ALL which allows to build the docs together with the application add_custom_target( doc_doxygen ALL COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMENT "Generating API documentation with Doxygen" VERBATIM ) else (DOXYGEN_FOUND) message("Doxygen need to be installed to generate the doxygen documentation") endif (DOXYGEN_FOUND) Upon running make , I get these errors:
Doxygen build started -- Configuring done -- Generating done -- Build files have been written to: /home/newproject/build [ 5%] Generating API documentation with Doxygen warning: tag INPUT: input source `doc/mainpage.txt' does not exist warning: tag INPUT: input source `src/player.cpp' does not exist warning: tag INPUT: input source `src/player.h' does not exist warning: tag INPUT: input source `test/tests-mainfunctionality-v2.cpp' does not exist error: tag OUTPUT_DIRECTORY: Output directory `doc' does not exist and cannot be created Exiting... CMakeFiles/doc_doxygen.dir/build.make:57: recipe for target 'CMakeFiles/doc_doxygen' failed make[2]: *** [CMakeFiles/doc_doxygen] Error 1 CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/doc_doxygen.dir/all' failed make[1]: *** [CMakeFiles/doc_doxygen.dir/all] Error 2 Makefile:83: recipe for target 'all' failed make: *** [all] Error 2 even though these files do exist. Is there something wrong with the paths I am using?
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}implies thatdoxygenexecutable will be called from the build directory. Sosrc/player.cppcannot be accessed from that directory.index.html) using CMake, see the response here.