我想用Cmake制作.chm文档。 相关代码片段:
set(doxyfile_in ${CMAKE_SOURCE_DIR}/doc/documentation-config.doxygen.in)
set(doxyfile ${CMAKE_BINARY_DIR}/Doxyfile)
configure_file(${doxyfile_in} ${doxyfile} @ONLY)
add_custom_target(doc
COMMAND ${DOXYGEN_EXECUTABLE} ${doxyfile}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMENT "Generating API documentation with Doxygen"
VERBATIM)
add_custom_target(chm
COMMAND chmcmd index.hhp
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/doc
COMMENT "Generating API documentation with chmcmd"
VERBATIM)
即。目前我定义了两个目标。这样make doc
生成html文件,然后make chm
生成.CHM文件。它工作正常,但需要一些手工。
是否可以将它们组合起来? (工作目录不同,所以我看不到在add_custom_target中再使用一个COMMAND) 理想的做法是将两个目标联系起来。
BTW:chmcmd给出了像
这样的消息Error: Anchor Memory_8cpp.html#a1e349bf268cc8c667b3d264111b6a3c1 undefined; first use Memory_8cpp.html
我确实有文件Memory.cpp,所以我想chmcmd
想要使用从我的文件派生的文件。我对此负责,通过不在Doxygen
中设置某个选项,或发生某些版本不匹配或其他内容?
BTW2:是行FindChmcmd
吗?
答案 0 :(得分:0)
最后,使用这里收到的建议,我到达了下面的配置文件。也许它有助于somone。
# ---[ Configuring Doxygen and maybe chmcmd
if(NEED_DOCS)
find_package(Doxygen)
if(DOXYGEN_FOUND)
message("Configuring ${PROJECT_NAME} HTML documentation")
configure_file(${doxyfile_in} ${doxyfile} @ONLY)
add_custom_target(doc
DEPENDS ${PROJECT_NAME} # Make sure to up-to-date source files
COMMAND ${DOXYGEN_EXECUTABLE} ${doxyfile}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMENT "Generating API documentation with Doxygen"
VERBATIM)
if(UNIX)
FIND_PROGRAM(DPKG_CHMCMD_FOUND chmcmd)
if(DPKG_CHMCMD_FOUND)
message("Configuring ${PROJECT_NAME} CHM documentation")
add_custom_target(chm
DEPENDS doc
COMMAND chmcmd index.hhp
COMMAND chmod 755 ${PROJECT_NAME}.chm
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/doc
COMMENT "Generating API documentation with chmcmd using Doxygen output"
VERBATIM)
add_dependencies(chm doc)
else()
message(AUTHOR_WARNING "chmcmd is needed to build the .chm documentation.")
endif(DPKG_CHMCMD_FOUND)
endif(UNIX)
else()
message(AUTHOR_WARNING "Doxygen is needed to build the .html documentation.")
endif(DOXYGEN_FOUND)
endif(NEED_DOCS)