[CMake] Adding files to project that don't exist

coordz at megaroms.co.uk coordz at megaroms.co.uk
Thu Apr 30 08:04:08 EDT 2015


Hi,

I'm using Doxygen to generate my project documentation and have a custom
target to do it. Like this:

find_package( Doxygen )

if( DOXYGEN_FOUND )
    configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in
${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY )

    add_custom_target( doc
                       ${DOXYGEN_EXECUTABLE}
${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
                       WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
                       COMMENT "Generating API documentation with Doxygen"
VERBATIM
                       SOURCES Doxyfile.in
    )
endif( DOXYGEN_FOUND )

which works fine. However, I'd like to extend this so the generated
index.html file is shown as part of the "doc" project when I use the
Visual Studio generator. Is there a way to do this? If the file already
exist I can coax CMake to include the file by adding it to SOURCES but
when the file doesn't exist (most of the time) CMake gives an error.

Any help is much appreciated.

Thanks.



More information about the CMake mailing list