[CMake] Adding files to project that don't exist
Hendrik Sattler
post at hendrik-sattler.de
Thu Apr 30 11:33:18 EDT 2015
Am 30. April 2015 14:04:08 MESZ, schrieb coordz at megaroms.co.uk:
>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.
Maybe the following works:
Make your doc custom target depend on the output file index.html and run doxygen in that custom command.
HS
More information about the CMake
mailing list